Skip to main content
GameDev.net gamedev.net
🔒 Locked

Rotating with versors...

Started by MatsK Oct 17, 2012 at 5:01 PM 0 replies 1.7k views
Original Post
MatsK
MatsK
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??

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.