Saturday, May 31, 2008

Ragdoll Physics

hi, long time without updates...
while shooting and killing bots i notice that something isn't right, something is missing - die animation or something like that.
so to fix that i thought i to create some new animation sets but that isn't perfect, so i decided to add ragdoll physics which have some drawbacks but is better then animation sets.
i added new script file like id does (.af files) which defines the physics bodies and properties also constraints between those bodies.
i also add new class that will read and manage the info and create the physics model from it.
after that i created two main functions:
1. setup physics bodies from current animation set - this is very useful function because you don't have to care about model pose and how to set physics from it, you just call this function and it will set the physics bodies to match current model animation.
2. set animation set from physics pose - used to alter model skeleton so everything applied to the physics bodies will change the visual model.
NOTE: when i setup physics bodies from skeleton i use T pose so it will be easy to setup physics bodies and constraints.
here is screenshot of ragdoll setup using T pose (red/green spheres is constraints)