Ragdoll recovering to animation

Today, we are going to create a simple scene were entities switch to ragdoll, and back to animation.

During this simulation, our poor zombie alternates between ragdoll physics and walking animation

Initial Setup

The initial setup consists in a character walking in an environment, with animated mesh that are designed to be traps for our entity.

The global behavior will be separated in two parts: the part that allows to fall and get up, and the behavior of the entity when not falling. To better focus on the fall-and-get-up part of the behavior, this tutorial won't address the other part of the behavior. You can have a look at the Quickstart Tutorial to create such a scene, simply add some animated meshes for the traps.

Only the Fall And Get Up part of the behavior will be explained here

Setting up collisions

To set up collisions correctly, the entity has to be physicalized, colliders needs to be set as rigid bodies, and a collision trigger has to be specified.

The rigid bodies

To convert your collider to rigid body, simply select them (you might select multiple colliders at once), and click on the Crowd Rigid Body icon in the Golaem panel:

The collider(s) is (are) now a Crowd Rigid Body, and thus interacting with our Golaem ragdolls

The ragdolls

Before anything starts, the entity needs to be physicalized. Add a Physicalize behavior in the entity's behavior graph. It should be configured to Physicalize mode, and its stop trigger should be set to true.

Before anything else, the entity should be physicalized

It's recommended to use the World Servo Rigidy Body mode because it will give better results at the time of impact, but as it may also bring a less quality animation, the kinematic mode is also an option.


The falling part of the behavior is set up inside the fallAndGetUp container seen in the previous screenshots. It's put inside a loop operator to make sure it will be able to fall-and-get-up multiple time during the simulation

The falling part of the behavior is simply made of a Physicalize behavior, set to dynamic mode:

The important part though is how the stop trigger is set.

As we want to switch to the entity to ragdoll (dynamic) mode when it's hit by the Rigid Bodies, we'll add a Physics Collision trigger to the stop trigger of behavior. Simply drag and drop the Physics Collision trigger icon () from the Trigger Library to the stop trigger of the behavior.

Select ID on the top list, and click on the + button to add a filter and configure it as follows. 

Rigid Body Collision ID are values that can be set when created a CrowdRigidBody (see here). >=0 basically means that a collision with any CrowdRigidBody will activate the trigger.

If you run the simulation at this point, the entity should fall whenever it's hit by a rigid body.

Getting up

Getting up is the tricky part. The main idea is to switch back to the physics kinematics mode while on the ground, but using a specific getting-up animation.

Ragdoll to kinematic

The time after which the ragdoll will get up can be configured with a block behavior operator (configure it for to wait at least till the ragdoll is stabilized, but it can be virtually as long as desired).

After the waiting time, the ragdoll should be switched back to kinematics mode thanks to a Physicalize Behavior (the Stop Trigger should be set to true for behavior to take effect immediately).

The trick here is to use the "Blend to animation time" available since Golaem 5.2.1 to force a smooth transition back to the animation.

If you start the simulation at this point, the entity should recover from the ragdoll dynamic mode, but the getting up animation is not quite realistic...

Getting-up animation

You'll need to have one or more getting-up animations for a better effect. Add it into a Motion behavior in parallel with the Physicalize behavior done in the previous step.

A few things should be done in the parameters of this behavior:

  • as a get-up animation usually starts lying on the ground, and ends standing up, do not forget to configure it as not looping;
  • as we don't want to blend this animation with the already running animations (walking, or whatever the character was doing before falling), we need to set the priority of this animation to something higher than any other Motion behavior (3 is enough in our case, as the default value is 2);
  • the stop trigger of this behavior should be set to a Motion Time Trigger ( in the trigger library) set to 100% animation time.

Here is how the full configuration looks like:

If you start the simulation at this point, the entity should recover from the ragdoll dynamic mode with a smooth transition to the stand-up animation.

You might try to use a Syncronized Motion behavior instead of a simple Motion behavior to ensure the getting -up animation starts from the ground height. In that case, make sure to configure it to synchronize only the height, not the 2d position nor the orientation, and map a 'Sync Objects' that is at ground level.

Looping back for next collision

If you need the entity to be able to fall again, you'll need to bring it back to the initial state, which was in world servo rigid mode. Let's add a last Physicalize Behavior configured to switch to the Servo Mode (once again here, configure the Stop Trigger to true for the change to take effect immediately).

As a final note, notice than you may have better collision results with the rigid bodies if you set the Maya framerate to something near 100Hz, and change the physics substeps in the Physics locator back to 1