Jump to content
  • Advertisement
Sign in to follow this  
theZapper

Transformations

This topic is 5036 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

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

Share this post


Link to post
Share on other sites
Advertisement
Make sure you rotate the object before transforming it in the real world.

Translate x Rotate != Rotate x Translate

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

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!