Jump to content
  • Advertisement

Archived

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

rtremaine

how can I perform a rotation in the direction of a line?

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

I have an object that is facing down my Z axis and I want to rotate it so that it points in the direction of point A to B. Is there an easy way to do this? Thanks, RT

Share this post


Link to post
Share on other sites
Advertisement
Strictly speaking you need two directions. You are pointing down the z-axis, but which way is up? With two directions a cross product will get you a third direction. If those three directions are mutually orthogonal, ortho-normal?, then you have everything you need for a rotation matrix. If you are unfamilar with rotation matrices think of a standard rectangular coordinate, i.e. (x,y,z). That says go so far in the x direction, then so far in the y direction and finally so far in the z direction. Here instead of the x direction being (1,0,0) it is some vector.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!