I've finally got my mini engine to work (with some vibrations but oh well), but I really need to add angle constraints to my ragdolls and I just can't figure out how they fit in the contact response calculations.
The main issue is that it is impossible to restrain rotation by only applying force/impule to one point. Currently I'm solving for impulse that would give the two bodies the same velocity at the contact point. If I split up the velocity and angular momentum response, then I end up with too many unknowns to solve for. And that's not even touching interpenetration handling. Also, if the constraints are given in euler angles, is it possible to express them in terms of quaternions to simplify the calculations somehow?
There seems to be an awful lack of materials on this topic. 99% of the online sources cover the very basic stuff or refer to off-the-shelf engines, and I can't just randomly buy every book and hope that it contains what I'm looking for (okay reading contents helps, but last time I tried that I ended up being wrong).
Also I have an issue that is possibly related to the original problem - if I swing a flail, I expect the ball to follow a large arc. However, in my simulation it just drags after the handle. I suppose forcing the chain to remain within a certain angle from the straight direction would fix it somewhat, but I might be missing something crucial. The flail handle is controlled by predefined animations, so I have to simulate the rest of the flail ragdoll based on its position/orientation. Currently I'm just taking the velocity of the tip (position change since the last frame) and plugging it into the response equations. However, it would seem that in order to get the result I need, the acceleration (or orientation change) would have to be factored in as well somehow, but none of my equations use accelerations anyway so I don't know where to start.