I've been working on implementing a paper on dynamic data-driven character control. (http://graphics.cs.williams.edu/papers/DynamoVGS06/)
The basic idea is to create rag-dolls and put them in certain positions by applying world space torques, which are computed by comparing the rag-doll's bone orientation and that of the desired position.
For this I created a rag-doll skeleton and a mannequin skeleton (no gravity or momentum) with the desired pose. The way I do it goes as follows:
1) compute the necessary torque for each bone with respect to the desired pose
2) applyAngularImpulse() on each bone
The formula for computing the necessary torque goes like this:
torque = (Desired Orientation - Actual Orientation) + (Desired Angular Velocity - Actual Angular Velocity)
All in world space.
For these I used the Entity's WorldTransform for orientation and the Entity's AngularVelocity property.
The results are not exactly what I expected. The skeleton starts to freak out. Even with dampening set incredibly high, I eventually get errors such as:
Some internal arithmetic has encountered an invalid state. Check for invalid entity momentums, velocities, and positions; propagating NaN's will generally trigger this exception in the getExtremePoint function.
during my space update, when applying forces to the model.
When I manually turn down the torque, it just seems that the force isn't strong enough to get the desired pose.
Here is a screen-shot:

The red doll is the desired pose, the green one the simulated doll. As you can see, the forces on the green doll do not seem strong enough, increasing them will cause instability.
So far I've figured out that:
- the IsAlwaysActive property helps stability a lot (I guess applying impulses to a non active object isn't a good idea)
- when I remove the angularvelocity from the equation, I get quite a limp character but no more bones flying all over the place.

I hope this isn't a little bit too vague but the paper is really not something you explain in a single post, hopefully someone can give any insight as to what I'm doing wrong? Should I be using motor's instead or something?
Many thanks in advance,
Rob