I have attached some bodyparts (kinematic rigidbodies) to the bone nodes of an animated character.
Soon I realized that I can’t really use Bullet to test for collisions on these bodies - kinematic bodies can’t actually hit each other in Bullet physics… what I really want to do, is to drive dynamic bodies via animation… but I don’t want to mess with motors and desired velocities, and the default order of events in urho updates could be a problem.
I examined the order of updates in the Urho engine, and I note the following:
E_UPDATE triggers the updating of each scene (presumably by order of scene id).
Within each Scene update, E_PHYSICSPRESTEP may nor may not fire, because physics runs at a fixed rate that differs to the framerate. E_SCENEPOSTUPDATE triggers the update of animation controllers, and it happens LAST in a scene update.
After all scenes are updated, we get E_POSTUPDATE - would this be the right place to overwrite the transforms of rigidbodies to match with animated bones? This seems rather late, for partial ragdolls, I now have to deal with transforming constraints themselves? I’d like to maintain angular and linear momentum… Erwin suggests zeroing them out, but that’s not acceptable for my use-case.