Search code examples
c#xnaxna-4.0

XNA - Extract rotation vector (angles) from world matrix


I got the positoin, forward and up vectors of an object. I'm using

Matrix.CreateWorld(Position, Forward, Up);

To get the world matrix, but I don't know how to extract the rotation vector. Also there is another way to get rotation vector out of position, forward and up vectors?

tnx.


Solution

  • you can use the decompose method:

     world.Decompose(out traslation, out rotation , out scale);