Ragdoll Behavior How-To

You can find the sample file corresponding to this How-to in the Golaem Crowd Samples

 

Initial Setup

 

The initial setup is very similar to a classical stadium, some people playing a loop sit motion at random, and a keyframed UFO flying over. When the UFO reaches the center of the character group, it starts spinning (still keyframe) and will suck up characters.

Here is an example made by Fullframe Filmes (see full video at the bottom of this page).

Create two EntityTypes: 

  • Green people will not be influenced by the UFO
  • Blue people will be sucked up

You can have a look at the Quickstart if you want to know how to create the initial setup

Each EntityType has a distinct behavior which is just playing a simple motion.


 

Creating a Physics Locator 

To be able to compute physics simulation, Golaem Crowd needs a Physics Locator. This locator describes the physical word (which objects are colliders) and provides global parameters like gravity.

As the world is very simple and you do not need any collision with the physical world, just use the "Default plane mode" which is an infinite plane located at the center of the scene.

You can have a look at the Preparing your scenes for physics if you want to learn how to descibe a more complex world.
 

Enabling Physics on your EntityType

As physics computation impacts performances, it is turned off by default. It should be activated for each EntityType which should be affected by physics.


 

Adding a Ragdoll Behavior 

Let's add a parallel operator and a RagDoll Behavior on top of the MotionBehavior

When it starts, the ragdoll behavior turn your motion controlled character (or parts of it) into a ragdoll (a physics controlled character). It can also apply an impulse force so that your character are thrown at a certain direction.

There are several way to describe this direction. The easiest way is to use a locator at the center of the UFO, so that it is computed automatically based on the character position. You can add a bit of noise, so that they do not ALL exactly reach the center of the UFO, but not too much, or they'll miss the UFO...

Then you can also control the intensity of the impulse (how fast they will reach the UFO). A positive intensity sends the characters away from the locator (explosion), so you need to use a negative intensity here.


 

Starting the Ragdoll Behavior

Last but not least,Golaem Crowd needs to be told when to start the ragdoll behavior. Let's make it start when the UFO start spinning, with a driven attribute trigger (or if you want to make easier, you can just use a current frame trigger...).

Each Trigger node has a drivenAttribute Attribute which can be connected to any floating point value of any Maya object. This way you can control your Golaem Crowd simulation with any Maya input. Here the rotation angle of the UFO (aka pSphere1) will be used.

First you need to connect the two attributes together using the Connection Editor (Window/General Editors/Connection Editor). Watch out about which object you select (you need to select the Shape of the Trigger, not its transform) and the way you are connecting them (from the sphere to the trigger)

When the attribute is connected, you can see its name and current value in the attributes editor of the Trigger node. Enable the Driven Attribute Trigger, and set a starting angle value and an operator (here greater than 150).

Also activate the Random Trigger so that they do not start exactly ALL at the same time.

Last but not least, uncheck the True trigger.

Hit play, and here you are!

It looks good but the characters do not stop in the UFO! You need to specify a stopping trigger.
 

Stopping the Ragdoll Behavior

You need a 3D Zone stop trigger so when they enter the UFO geometry, the ragdoll behavior stops and they stay in place.

Select the UFO (pSphere1) and map it in the Zone Trigger of the RagdollBehavior Stop Trigger (tips: after selecting it, open the behavior editor, and while holding SHIFT, select the stop trigger on the Ragdoll Behavior, click map in the attribute editor).

Activate the Zone Trigger, and check the 3D checkbox.

Do not forget to uncheck the False trigger, or it won't work at all.

Finally, if you want the character to stay still when the ragdoll behavior stops, you have to select the "Locked Posture" stop mode in the Ragdoll Behavior (or else they will just fall back on the floor and sit down again, it's fun but not what you want)


 

Further Improvements

If you want to enhance the effect even more, you can play with the Impulsion Mask and the Animation Mask (see above attribute editor picture).

The impulsion mask enables to apply the impulsion on only some body parts. For example, if you apply the impulsion only on the left part of the body, they will twist while flying.

The Animation Mask enables to define which part of the body will be controlled by physics or not. If you uncheck arms and legs, and play a Motion Behavior in parallel, you can control the global character position thanks to physics and play a panicked behavior on the arms and legs.

For example, remember that at the beginning of the scene we put the Sit Motion Behavior in parrallel with the Ragdoll Behavior. Let see what happens if you uncheck some checkboxes in the Animation Mask

You can see that they keep their legs folded and the arms close to their body. You can then get the best of both worlds!

 

In Production

To illustrate this case in production, watch this commercial for Brahma, a famous brazilian beer brand, made by Fullframe Filmes.