Jump to content
  • Advertisement
Sign in to follow this  
jkh13

Question about BVH motion capture file parsing

This topic is 2511 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am writing a simple program using XNA to parse in a BVH motion capture file and display it on the screen. I am not sure I am doing everything correctly however.

From what I understand, the XYZ local rotation of the current bone should be chained with it's parents global rotation in order to get the global rotation of the current bone. However when I display my skeleton on the screen and apply a rotation to a bone, its children do not rotate with the parent. This is shown below:

18kv2d.png

The child of the upper leg is lower leg.

The code I wrote is as follows:


foreach (Bone b in bones)
{
b.localTransform = Matrix.CreateTranslation(b.Offset) * Matrix.CreateRotationZ(b.z) * Matrix.CreateRotationY(b.y) * Matrix.CreateRotationX(b.x);
Bone parent = b.parent;
if (parent != null)
{
b.globalTransform = parent.globalTransform * b.localTransform;
b.location = b.globalTransform.Translation;
}
}


Where bones is an ordered list of the bones with the children of a bone always appearing in the list after itself. B.location is the vector location of the bone joint.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!