Jump to content
  • Advertisement
Sign in to follow this  
mathaig

Axis alignment math

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

Hello,
I have two arbitrary matrices M1 & M2 and I would like to Rotate M1 in such a way that any one of the axis (Up, At or Right ) of M1 aligns with any one of the axis of M2.

Eg:
Align X-of-M1 to Y-of-M2, or
Align Z-of-M1 to X-of-M2,

Is it just enough that I take the src and dst axis, find the cross, dot and generate a rotation nudge matrix (Mn) So,

M1 = M1 * Mn

Thanks & regards
Mat

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Is it just enough that I take the src and dst axis, find the cross, dot and generate a rotation nudge matrix
Yes, that is a typical solution. (Just watch out for cases where the magnitude of the cross product is small, as normalization may fail in that case.)

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!