Rotating with versors...

Started by
-1 comments, last by MatsK 11 years, 6 months ago
Can someone please explain how to rotate using a versor in XNA?
I'm trying to setup a skeletal render using the SKEL format in XNA;

"Rotation - A normalized quaternion, called a "versor", consisting of X,Y,Z,W coordinates, each a 32-bit little-endian float, which specify the default direction of rotation"

It seems the common way to rotate in XNA is to create matrix from a Vector3 instance. I've tried creating a matrix using Matrix.CreateFromQuaternion(), but that doesn't seem to work very well. Here's the code I'm currently using;


/// <summary>
/// Compute the absolute transformation for this bone.
/// </summary>
public void ComputeAbsoluteTransform()
{
if (ParentName != "NULL")
{
m_AbsoluteTransform = Matrix.CreateFromQuaternion(GlobalRotation) * Matrix.CreateTranslation(GlobalTranslation) * Parent.AbsoluteTransform;
}
//This bone didn't have a parent, which means it is probably the root bone.
else
{
m_AbsoluteTransform = Matrix.CreateFromQuaternion(GlobalRotation) * Matrix.CreateTranslation(GlobalTranslation);
}
}


I've searched for examples, and the most relevant I've been able to find so far is this one. It doesn't help me very much though...

Please help, how do I do this??

This topic is closed to new replies.

Advertisement