Sign in to follow this  
theZapper

Transformations

Recommended Posts

theZapper    150
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
theZapper    150
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
TheAdmiral    1122
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this