email github twitter linkedIn
C++ Ragdolls

2013 • Student Project


For my Graphics Programming project in my 2nd year in college I've implemented Ragdolls in the Overlord Engine 0.44. The Overlord Engine 0.44 was a framework that used DirectX 10 and AGEIA PhysX (later acquired by Nvidia). Nowadays there is a more up to date version that uses DirectX 11 and Nvidia PhysX. The framework was created by Thomas Goussaert and later expanded by Thomas and myself.

While creating this test I've expanded the framework to support runtime serialization (with PhysX state support), PhysX contact reports and force fields while fixing several bugs and implementing the required features.

Several code snippets are available by clicking this link, by clicking the "source code" logo on top or in the section down below.


PhysXBone: these functions are the core of the ragdoll. The MapToBone function calculates the correct transformations of the bone based on the bind-pose of the character. The UpdateLeechMode and UpdateSeedMode are the update functions for the animation driven ragdoll (leeching from the animations) and the physics simulated ragdoll (seeding bone information based on the physics data). The animation driven mode is necessary to make sure the physics skeleton maps to the character while he moves, so whenever we click on a certain body part, we grab the zombie by that body part.

EnemyController: this is an example of how a character can be moved using the CharacterController component of AGEIA PhysX. As with most physics controller components, the movement is relative and should be calculated by the user. Using the Move() function, users are then able to feed their calculated transformation to the physics api for further simulation.

ForceField: force fields are a great way of introducing area-based forces in physics. Below is an example of how you can setup such a force field, in this case a gravitational force field, using AGEIA PhysX. I manually enable or disable this forcefield based on game parameters to introduce certain gameplay mechanics (power-up to help the player).