D3DXMatrixRotationXYZ problem!

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

Recommended Posts

Share on other sites
When you want to rotate an object on all axis I would suggest using D3DXMatrixRotationYawPitchRoll
Quote:
 Finally, I know this might be a stupid question, but is it possible that problems like this arise because of the compiler I use(Visual C++ 6)?

No

Use a different matrix for Z axis rotation and multiply it with the object matrix you already have.
That should solve it.

Share on other sites
Try reversing the order of your rotations. That might work the way you expect. Keep in mind that it is likely that everything is working correctly, but you are misunderstanding how rotation works (as many people do). You can only do one rotation around a global axis (the last one). All previous rotations are around local axes.

Share on other sites
Quote:
 You can only do one rotation around a global axis (the last one). All previous rotations are around local axes.

Not sure what this means. Fix a coordinate system. Then rotate points as many times as you like about any of the coordinate system's axes.

Share on other sites
ok, I tried reversing the order of rotations, and I had the same problem with
the same axis (I think it was Up), which is weird(I tried every possible order).
I changed the order I multiply the rotation matrices into totalrotation, although I do not understand why the order of rotations changes anything.i understand this in the case with rotation and translation.

I didn't really understood how to make a different matrix for Z rotation
You say I do the X,Y rotations, multiply them with the TotalTransform matrix,
do the Z rotation and multiply it also with the TotalTransform matrix?

About the D3DXMatrixRotationYawPitchRoll: I tried it and it rotated my object around it's local coordinates.This is ok(although i don't know if this is what this function is supposed to do),but what I want is this:
Define the objects Direction vectors(Up,Right and LookAt),use D3DXMatrixRotationAxis three times to rotate the object around these vectors,
and then use these vectors, for example the LookAt vector, to move the object in
direction .Of course, after rotating, I used D3DXVec3TransformCoord with the totalrotation matrix to transform the vectors.Basicaly I took the code from the camera class and tried to make it work with objects.It didn't.

Can you please tell me more about not doing all three rotations in the same space?in my case it seems I can only do two rotations in world space and the third is done in local object space.

1. 1
Rutin
29
2. 2
3. 3
4. 4
5. 5

• 13
• 13
• 11
• 10
• 13
• Forum Statistics

• Total Topics
632959
• Total Posts
3009468
• Who's Online (See full list)

There are no registered users currently online

×

Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!