Transformations

Started by
3 comments, last by LilBudyWizer 19 years, 6 months ago
How do I rotate an object around it's own local coordinate system rather than the world system? i.e. if I have a plane flying up and to the right and I want it to pull up a bit, how do I rotate it around it's local x axis rather than the global one which will be completly different. Thanks
---When I'm in command, every mission's a suicide mission!
Advertisement
Make sure you rotate the object before transforming it in the real world.

Translate x Rotate != Rotate x Translate
No bombs, No guns, just an army of game creators...
Quote:Make sure you rotate the object before transforming it in the real world.

Translate x Rotate != Rotate x Translate


Yeah I know, but I'm actually transforming a vector which is pointing in the direction of travel. so the vector always originates from (0,0,0) but just rotates. What I need is to rotate the vector coordinate system so that every time to object rotates, it rotates relative to it's last position.
---When I'm in command, every mission's a suicide mission!
You shouldn't be rotating the spaceship's position vector at all if it is to rotate about its local axes. If the only vector you're using is based around the global origin (it will be a position vector), you'll need to introduce another vector to represent the ship's orientation.

What are you using to render and how many dimensions are you working in?
If you're using a 3D API (or any matrix based geometry), make the translate call before the rotate call.
Ring3 Circus - Diary of a programmer, journal of a hacker.
If you want to rotate some object around (x,y), instead of (0,0), you translate the object by (-x,-y), perform the rotation, then translate it by (x,y).
Keys to success: Ability, ambition and opportunity.

This topic is closed to new replies.

Advertisement