Jump to content

  • Log In with Google      Sign In   
  • Create Account


Ragdoll Physics and Skinning


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 Michael Smith_49683   Members   -  Reputation: 100

Like
0Likes
Like

Posted 07 January 2012 - 01:05 AM

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.

physics0.jpg

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[i];
bone.ComputeAbsoluteTransform();

m_boneTransforms[i] = 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

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