Advanced math help (Yaw, Pitch, Roll)

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Advanced math help (Yaw, Pitch, Roll)

Postby Auradrummer » Tue Jun 16, 2009 9:41 am

Hello guys,

I'm facing a big problem here.
Image

Here is my car, and I have to make it steer. I don't want to use the default car joint of Newton for personal reasons (nothing against it, of course ehehehe).
That green circle represents the Yaw of the wheel, and the Red represents the Pitch. As you can see, the yaw is the steering, and the pitch is the natural rotation of the wheel.

But, the problem is that the yaw is dependent of the pitch angle. When the wheel spins, the yaw spins together. This way, when the pitch is 0 or 180 degrees, the steering works well, in the plane of the car, but if the pitch is 90 or 270 degrees, the plane of the steering is vertical, and this way with any angles.

The only solution I can think about is changing the orientation of the matrix and exchange the Yaw with Pitch but, despite the bunch of documents I had read, no success.

Someone knows how to do this?

Thanks
Developing a racing game.
Auradrummer
 
Posts: 132
Joined: Sat May 17, 2008 9:17 am

Re: Advanced math help (Yaw, Pitch, Roll)

Postby Julio Jerez » Tue Jun 16, 2009 10:11 am

if you keep the angles as two independent variables, and each time you build the tire matrix then it will be fine.
keep Yaw, and Roll and two variable then the tire mnatrix is

tirelocalMatrix = pitchMatrix (pitch) * yawMatrix (yaw) * rooMatrix (roll)



any particular reason why you do no wnat the car joint?
If you tell me we can make the chnages to make it more atractive.
the Next beta will expose the the mutibody car joint again, with the mutibody car all car behavior come as an emerging physic behaviuor. As oppose to the raycast car were the behavoir are basic on equations.
with that car joint controlling the whell oritation is simple, because that is what the wheel contraint do.
check out the atv demo in the beta 2.00 thread.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Advanced math help (Yaw, Pitch, Roll)

Postby Auradrummer » Tue Jun 16, 2009 10:20 am

Greetings Master!

That's good. But, if I do this, how can I build a roll matrix without loosing the torque applied to the wheel? I'll have to set an angle to build the pitch, right? ... (unless I not rebuild the pitch matrix ... should work!).

No specific reason to not use the car joint, but, if I want to make a good game, I need to know how to work well with matrixes. So, I think this is a very nice opportunity to learn how to handle them. My reason is not about the efficience, but only a matter of achieve more knowledge. I'm building the whole car without using any preset joint, and I'm almost there!

Thanks!
Developing a racing game.
Auradrummer
 
Posts: 132
Joined: Sat May 17, 2008 9:17 am

Re: Advanced math help (Yaw, Pitch, Roll)

Postby Auradrummer » Tue Jun 16, 2009 10:25 am

Hummm, the problem persists ...
Developing a racing game.
Auradrummer
 
Posts: 132
Joined: Sat May 17, 2008 9:17 am

Re: Advanced math help (Yaw, Pitch, Roll)

Postby Auradrummer » Tue Jun 16, 2009 10:46 am

Ah! Good,

There is an specific order to multiply the matrixes... If the steer is the last one, worked fine, and I don't loose the torque, because I used the EulerAngles to keep it to build the pitch matrix.

But, the Rool isn't fixed at 0. When I steer, I get an roll distortion before is came back to 0. I think if I managed the inertia, maybe...
Developing a racing game.
Auradrummer
 
Posts: 132
Joined: Sat May 17, 2008 9:17 am

Re: Advanced math help (Yaw, Pitch, Roll)

Postby Julio Jerez » Tue Jun 16, 2009 10:54 am

Auradrummer wrote:Greetings Master!
No specific reason to not use the car joint, but, if I want to make a good game, I need to know how to work well with matrixes.
So, I think this is a very nice opportunity to learn how to handle them. My reason is not about the efficience, but only a matter of achieve more knowledge.
I'm building the whole car without using any preset joint, and I'm almost there!
Thanks!

Oh I see, I commend your effort of trying to learn as you go alone.
However car game physic is one of the things that is very difficult to master.
Of all of the reason for not using the joint, leaning how to work with matrices is probable the worst I can think off.
Thrust me people with 15 to 20 years of experience in Physics, AI, graphics and general gaming still fail at making car that are useful, making one that is fun and stable is out of the question.
Trying to learn matrix algebra by making a car game is like trying to learn Newtonian physics starting with Einstein General Relativity.
Believe it will do you a lot of good using the Joint, there is not shame on that, even the most sophisticated companies’ use software that is already written, speciatly for car dynamics (thrust me on that).
You can step in the joint and see how the matrix is constructed, and it will teach you more.

In a nutshell the reason your matrices do not work is because a car is not an animation, the tire are physics bodies,
so when you apply a torque there are reactions forces that if not calculated properly they will make the tire move away on unwanted direction.
That is the job of the Joints.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Advanced math help (Yaw, Pitch, Roll)

Postby Julio Jerez » Tue Jun 16, 2009 11:13 am

I see you are puttong a lot of effort on this.
Are you using your own Graphics engine, or a third party one? Is your engiene c, or c++?

if you are scare of implementing the car joint, maybe and I can give you some pointers to get started,
The you can continue building from a basic framewor.
Send me a PM.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Advanced math help (Yaw, Pitch, Roll)

Postby Auradrummer » Tue Jun 16, 2009 1:15 pm

I'm using all physics treatments of Newton Dynamics and graphics from Irrlicht.

Is probably I'll use car joints in the future, but now, I learnt how to handle some matrices, and my wheel worked now. Let's me make four wheels and see what happens.

Thanks for your great help!
Developing a racing game.
Auradrummer
 
Posts: 132
Joined: Sat May 17, 2008 9:17 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 6 guests

cron