Neosani
Neosani

Reputation: 172

How do i create a rotation matrix given a direction vector?

I am trying to rotate an object to face the direction it is moving in. We want it to face the normalized velocity vector.. help... pls...

Upvotes: 0

Views: 3089

Answers (1)

Marcel Jackwerth
Marcel Jackwerth

Reputation: 54782

Have you tried Matrix.CreateLookAt (MSDN)?

// Matrix.CreateLookAt(eyeLocation, lookAt, upVector); 
Matrix.CreateLookAt(currentPosition, currentPosition + velocity, Vector.Up);

Upvotes: 2

Related Questions