Jump to content

  • Log In with Google      Sign In   
  • Create Account


Rotating with versors...


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 MatsK   Members   -  Reputation: 223

Like
0Likes
Like

Posted 17 October 2012 - 11:01 AM

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??

Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS