Archived

This topic is now archived and is closed to further replies.

Rotation - from the Pilot's point of view

This topic is 5402 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I''m messing around with Rotation and I am having a problem that has been annoying me for ages. Is there a rotation system I can use, or a trick that I can employ, to be able to store rotation that treats every axis as independant? To explain what I am looking for - I would like to use Roll, Pitch, Yaw to specify the rotation of an object. But I would like these axes to be from the point of view of a ''pilot'' within the object. When you normally do a rotation, you do the Pitch, then the Yaw, then the Roll. But this means that your Yaw is BASED ON THE ALREADY PITCHED OBJECT. I would like the Yaw to work as if the first rotation was never made. It''s very difficult to describe without pictures, but the basic idea is that if you imagine yourself flying a plane, and you wish to roll it, it will roll around the objects center of balance, regardless of how high you are tilted or what direction you are facing. I want to be able to do something very much like that. Any help would be a godsend... Thanks.

Share this post


Link to post
Share on other sites
If you''re using DirectX 9, I know there is a matrix transformation that you can use to simulate yaw pitch and roll. I don''t know if it''s in previous versions...

Matrix.RotateYawPitchRoll(float x, float y, float z)
(if it isn''t exactly that, it''s something like it. I use VB.NET)

As far as using it to simulate the pilots point of view, that would probably take a little imagination. But as far as changing the cockpit''s position as well as other flying things, you can use the above matrix.


"There is no failure without trial; for that matter, there is no success either." - someone

Share this post


Link to post
Share on other sites

Thanks for the suggestion, but unfortunately I''m using OpenGL. I''m currently playing with Quaternions, with the hope that I can make them do something similar to what I''m trying to do.

I''m just surprised that there isn''t a simple, easy method of doing what I''m trying to do, as I would expect it to be a fairly common requirement. It''s just basically a Euler coordinates, but treating every rotation as independent rather than related.

Oh well, I''ll keep trying...

Share this post


Link to post
Share on other sites
I''m not sure how this will work, but you can always try it...

to make consecutive, unrelated transformations try doing something like:

glLoadIdentity ();
//pitch up
glPushMatrix ();
glLoadIdentity ();
//roll
glPopMatrix ();
.
.
.

this should allow you to do a transformation, store the matrix in the stack, and then do another translation from scratch (load identity) and then pop the previous tranformation from the stack again...

give it a whirl.. let me know how you get on. i can;t try this at the moment to see if i am right or not, so let me know..



-----------------------
"Without a sense of humour we couldn''t react to a lot of things"

Share this post


Link to post
Share on other sites
There are some problems with treating each axis independantly and that is the Gimbal Lock. If you are rotating the object about world axes (which appears to be what you''re implying) then you can end up yawing instead of rolling. For example, say the pitch is 90 degrees up (so the nose is pointing vertically up) and you then apply a roll - the plane will appear to the pilot to yaw, which won''t be what you''re after.

The solution is to incrementally update the matrix, i.e. update in object space, or use a quaternion (more complex conceptually).

Look up "Gimbal Lock" on google or even "Flight Simulation".

Skizz

Share this post


Link to post
Share on other sites