Sign in to follow this  

how to get orientation from a target vector?

Recommended Posts

Helo7777    693
Hi, Im looking for a way to get an orientation from a direction vector. Im using quaternions for orientation and its in 3D. For example, I have an entity at position v1 and I want the orientation to the target position v2 so it can face in that direction. Thanks for the help.

Share this post

Link to post
Share on other sites
KulSeran    3267
It is simple enough to make a matrix from that, and convert it to a quaternion.

ndir = Normalize(dir); = ndir;
orientMat.left = Cross(UpVectorGuess,;
orientMat.Up = Cross(, orientMat.left);
convertToQuat ( orientMat );

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