Jump to content
  • Advertisement
Sign in to follow this  
Michael Smith_49683

Ragdoll Physics and Skinning

This topic is 2535 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

Hello All!

I have having a problem with skinned meshes and ragdoll physics using BEPUPhysics in XNA 3.1. I am not a math expert, and the issue lies mostly in not understanding how to skin my meshes when physics is activated on a mesh (ie. ragdoll)

I already have skinned meshes rendering and animating. The problem lies when physics takes over in my game.

When I activate physics, whether in the T-Pose or in the middle of an animation on a mesh, I create a bunch of physics boxes using BEPU and add them to the physics space. They are positioned in world space given the animations current bone transformations and world transform. Using constraints, they seem to render fine using debug boxes I created, and fall/contort realistically.

First picture is T-Pose with user defined collision boxes. Second picture is when physics takes over and the physics objects laying on some steps below.

[attachment=6628:physics0.jpg]

[attachment=6629:physics1.jpg]

So, again I am not sure how to transform my vertices to match the ragdoll. I have a skinned shader which takes a world matrix and skeleton transforms, and then performs pretty standard hardware skinning. The skeleton transforms are calculated below for animations, which I believe is pretty standard.


for (int i = 0; i < bones.Count; i++)
{
Bone bone = bones;
bone.ComputeAbsoluteTransform();

m_boneTransforms = bone.AbsoluteTransform;
}

//
// Determine the skin transforms from the skeleton
//

for (int s = 0; s < m_modelExtra.Skeleton.Count; s++)
{
Bone bone = bones[m_modelExtra.Skeleton[s]];
skeleton[s] = bone.SkinTransform * bone.AbsoluteTransform;
}


public void ComputeAbsoluteTransform()
{
Matrix transform =
Matrix.CreateScale(Scale * bindScale) *
Matrix.CreateFromQuaternion(Rotation) *
Matrix.CreateTranslation(Translation) *
BindTransform;

if (Parent != null)
{
// This bone has a parent bone
AbsoluteTransform = transform * Parent.AbsoluteTransform;
}
else
{ // The root bone
AbsoluteTransform = transform;
}
}

I would appreciate some direction in how I need to calculate the skeleton matrices given box physics objects in world space. =) I am having lots of trouble understanding the concept and step-by-step instructions on how to proceed, especially after just wrapping my head around animation skinning. Thank you so much, I'm sure I'll need to elaborate more on certain things.

- Mike

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!