First off, I want to thank the creator(s) of BEPUPhysics as it is really a great library. I am having a problem with rendering ragdolls. I have my own rendering system I created for my game engine. I know this is a rendering problem, but it is heavily influenced by physics. I think I'm just a little burned out so I'm having trouble solving this issue.
I am 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.


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