Archived

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

aleks_1661

Rotation Order?

Recommended Posts

Hey, im making a space based kinda game, but i am having trouble with rotating the player. if i pitch up and then roll, instead of the pivot being in the middle of the screen, it is where it was before i pitched. This causes the screen to ''Wobble'' instead of rotate and i cant seem to make any diffence. I know that the order of operation when rotating does affect the result but ive had no luck. the way i am constructing the game is as follows. the stars are mapped onto a cube (The textures were created with 90 degree fov) i then rotate the cube to give the appearance of movement. the position of the ship is stored as a vector (my own implimentation, containing x, y, z, xrot, yrot, zrot, magnitude) The skybox is rotated using the xrot, yrot and zrot data members. why dont you work you f*#@&$g piece of junk!

Share this post


Link to post
Share on other sites
OK. Here is what is what''s going on.....

When you are rotating the player, you are doing so around the WORLD axis not LOCAL axis.

I.e. if you are in a plane flying upside down and you bank to the right, you bank to YOUR right. Using the WORLD axis the plans would bank left.

Get the picture?

What you need to do is something along the lines of the following.

Rotate your objects axis (thats right your x and y axis get rotated by z, x and z by y, z and y by x). (Remember your axis are unit vectors so you can treat them as positions. x axis - 1,0,0, y axois 0,1,0, z axis 0,0,1). Each rotation you apply is incremental, this means if you turn to the right by 1 degree, then you apply a rotation of 1 degree.

The trick is to find the rotation you need to apply to get your axis back to thier norms. You achieve this by determining the SLERP between the WORLD orientation and the LOCAL orientation. This will give you an AXIS Transformation you need to apply to your model in which to orient the model to the model''s axis.

Ok... I had to work this out myself as no one here (in GAMEDEV) ever gave me a clear answer to this very question.

The hint here is that you use axis rotations to get to where you want to get.

OK. here is the clincher: I can get this method to work IF i manually transform all the point data myself. But when I set the WORLD TRANSFORM and I get the ''wobbly rotation'' effect. So I am still kinda working on it. The problem lies in ''upgrading'' my code from DX7 to DX8, well thats my story and I''m sticking to it.



D.V.

Share this post


Link to post
Share on other sites
Thanks that shouldnt be to much of a problem. i already have some functions to do that kind of stuff. But does that mean i cant use glRotatef in my program at all? (im using opengl)


why dont you work you f*#@&$g piece of junk!

Share this post


Link to post
Share on other sites
Might you post your rotation code along with the ship world position?

Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."

Share this post


Link to post
Share on other sites
That''s Funny!
I just had the same problem , well I still have it particularly. Look at How to move around in space !

Share this post


Link to post
Share on other sites