Jump to content
  • Advertisement

Archived

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

Igilima

Getting a rotation matrix based on position and target vector?

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

Hi. Is there a function that I can use to create a rotation matrix based on a position vector and a target (aim at) vector? I tried using D3DXMatrixLookAt() and got some crazy results when I applied the matrix. I have a scale and translation matrix as well and know that order of multiplication matters but none of the combinations worked for me. I can always write some code to use trig functions to figure out degrees or radians but I would much rather know about and use an existing function. Thanks for any pointers.

Share this post


Link to post
Share on other sites
Advertisement
try this:

normalizing the vector should give you the rotation should it not? not sure i might be wrong, if so, please let me know :D

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!