For the last week I've been working on this ragdoll editor for XNA utilizing jiglibx, and I'm almost done with it. I still have two issues remaining though.
One is that some joints are sorta unstable. It works good enough when I'm only connecting the primitives using hinges, but I tried implementing a pivot joint by connecting two body primitives to a proxy body using hingejoints, one representing a hinge and the second an axis. But for some reason this "proxy body" is really unstable. It can barely keep the bones straight at all.
The second problem is simply that I'm not sure how to determine the correct velocity for the primitives when switching from RagdollToAnimation mode to ModelToRagdoll.
List<Vector3> savedPositions = new List<Vector3>(); foreach (PhysicsEntity entity in primitiveList) savedPositions.Add(entity.PhysicsBody.Position); RagdollToModel(); for (int i = 0; i < primitiveList.Count; i++) primitiveList[i].PhysicsBody.Velocity = primitiveList[i].PhysicsBody.Position - savedPositions[i];
I simply determine a velocity for each primitive by comparing the current primitive positions to the positions they had the last update, but I'm sure I am supposed to calculate a delta time as well and use it some way to get the proper velocity, I'm not just sure exactly what velocity means in JigLibX.