On this page

Overview

Sometimes you want to transition agents to a state where instead of being controlled by animation, they are controlled by a rigid body simulation. For example, if an agent dies, you want it to fall to the ground, with its body and limbs being knocked around by collisions.

Setting up a ragdoll scene

Use the Simulate shelf tool to quickly get a basic crowd simulation scene up. Then tweak the network for your purposes.

  1. Press ⌃ Ctrl + on the Simulate tool on the Crowds shelf tab. The tool will automatically build agents and a crowd source network using the mocapbiped1 character built into Houdini.

    Object-level network created from the Simulate shelf tool

    The crowd simulation network (crowd_sim) created by the Simulate shelf tool:

    Crowd simulation DOP network
  2. Play the simulation by clicking Play on the playbar. The agents will stand, and then walk.

  3. In the current scene, the agents only transition from the “stand” state to the “walk” state. Add another trigger to transition the agents from the “walk” state to the “ragdoll” state.

    Add a transition to the ragdoll state
  4. Play the simulation. The agents will stand, walk, and then fall through the scene, because they have nothing to collide against.

  5. Add a ground plane (Ground Plane DOP) for the agents to collide against. Connect the Ground Plane DOP to the merge_static_collisions node.

  6. Play the simulation. The agents will stand, walk, and then fall on the ground as ragdolls.

Agent setup ragdoll

The Simulate shelf tool sets up an agent definition network (mocapbiped1_setup), a geometry network that defines the agents in a crowd simulation.

Agent definition network, mocapbiped1_setup

The ragdoll-specific information in the agent definition network are:

  • Collision shapes (Agent Collision Layer SOP) - Defines simple geometry around the agent’s skeleton that are used to determine the surfaces to collide against when the agent becomes a ragdoll.

  • Configure joints (Agent Configure Joints SOP) - Specifies the range of motion for each joint.

Collision shapes

Collision shapes define simple rigid geometry around the agent’s skeleton that are used to determine the surfaces to collide against when the agent becomes a ragdoll.

In addition to assigning agent layers to individual agents to specify the shapes that should be displayed for them, you can assign a separate set of collision layers per agent to specify the shapes used for collision detection.

The Agent Collision Layer node can be used to create collision shapes which are suitable for ragdoll simulation. By default, it creates collision shapes based on how the agent’s geometry (skin) is weighted to the skeleton joints. The collision shapes can be displayed and updated in the Agent Collision Layer viewer state:

  1. In the agent definition network, select the Agent Collision Layer node and turn on its display flag.

  2. Press Enter over the viewport, or click on the left toolbar to enter the Agent Collision Layer viewer state.

    By default, the Agent Collision Layer SOP creates convex hull collision shapes for all the joints.

    Convex hull collision shapes

    Tip

    It is faster for the ragdoll solver to simulate basic shapes like capsules and boxes, as opposed to the convex hull shape. This is relevant for large crowds when the solver is simulating thousands of ragdolls at the same time.

  3. To manually adjust the position, orientation, and scale of collision shapes, use the transform handle on the shape:

    • Select a shape or joint.

    • On the top toolbar, turn on Enable Handle.

    • (Optional) Press Y over the viewport to cycle through the different transform handle modes.

    Note

    Selecting a joint or shape will automatically change the shape to the Shape setting on the top toolbar.

  4. To create one collision shape that encapsulates multiple joints, for example, one collision shape for the entire hand:

    • Select the finger joints/shapes.

    • click and select Merge Convex Hull with Parent.

      Generate one collision shape from selected joints

    The Generate Shapes Group parameter on the node is updated to list the joints for which collision shapes are not generated (the joint names are preceded with a ^). These joints have their collision shapes merged together with the parent shape.

  5. To undo the merging of multiple collision shapes with the parent shape:

    • Press Z to enter the Restore from Groups mode. The joints that have been merged are available to be selected.

    • Select the joints.

    • click over the viewport and select Restore Convex Hull.

    • Press Z again to exit the Restore from Groups mode.

Create custom collision shapes

  1. In the viewer state, select a shape or joint.

  2. On the top toolbar, set Shape to Custom.

  3. (Optional) click the Select button from the left toolbar, and choose one of the selection options.

  4. Press S over the viewport, which shows the character skin.

  5. Select the areas on the character skin that you want to use to create the custom shape.

  6. Press S or Enter to exit the selection mode. A convex hull is built out of the selection.

    Create custom collision shape
  7. To remove the custom shape:

    • Select the shape or joint.

    • Press S over the viewport to show the character skin.

    • Click away from the character skin so that nothing is selected.

    • Press S or Enter to exit the selection mode.

Working with basic shapes

You can choose to use basic shapes for the collision shapes, which can be useful for improving simulation performance or in cases where the agent does not have skin geometry.

To set all the collision shapes to use basic shapes:

  1. On the Agent Collision Layer SOP, turn off Generate Convex Hulls from Skin Geometry.

  2. Turn on Generate Basic Shapes. This will create collision shapes automatically based on the skeleton joints.

  3. Select the shape to use from the drop-down menu.

To set certain collision shapes to use basic shapes:

  1. In the Agent Collision Layer viewer state, select the shape(s).

  2. On the top toolbar, select the shape to use from the Shape drop-down menu.

Orienting and positioning basic shapes

To orient basic collision shapes toward certain joints:

  1. In the viewer state, select a basic shape or its associated joint.

  2. Press A. The joint options that the shape can be oriented towards are shown:

    Joints that the collision shape can be oriented towards
  3. Select the joint to orient the shape towards:

    Orient basic collision shape

    Note

    If Compute Shape Transform on the top toolbar is set to Off, you won’t see the effect of reorienting the shape until Compute Shape Transform is set to From Convex Hull or From Reference Joint.

To automatically position basic collision shapes:

  1. Select a basic shape or its associated joint.

  2. On the top toolbar, select from the Compute Shape Transform drop-down menu:

    • From Convex Hull scales the shape and places it within the bounds of the convex hull.

      Collision shape placed within convex hull bounds
    • From Reference Joints uses the distance between the selected joint and reference joint to scale the shape.

      Collision shape between selected and reference joints
    • Off centers the shape at the selected joint.

      Collision shape placed at selected joint

How-to

To...Do this

Display the collision shapes without entering the Agent Collision Layer viewer state

On the Agent Collision Layer SOP, turn on Display Collision Shapes. This enables guide geometry which displays the shapes along with the agent’s geometry.

or

On the Agent Collision Layer SOP, turn on Set as Current Layer. This changes the agent’s geometry to display only the collision shapes.

Change a collision shape

In the Agent Collision Layer viewer state:

  1. Select the shape or joint.

  2. On the top toolbar, select from the Shape drop-down menu.

    or

    Press G over the viewport to bring up the shape options HUD.

    or

    Press P over the viewport to bring up the collision shapes parameters window. In the Viewer State Dialog tab, select from the Shape drop-down menu.

Use basic shapes for all the collision shapes

  1. On the Agent Collision Layer SOP, turn off Generate Convex Hulls from Skin Geometry.

  2. Turn on Generate Basic Shapes.

  3. Select the shape to use from the drop-down menu.

Revert back to the original collision shapes

On the Agent Collision Layer SOP, click the Clear Overrides button. This reverts all the collision shapes.

or

To revert specific shapes, in the Agent Collision Layer viewer state:

  1. Select the shape/joint.

  2. click over the viewport and select Remove Override.

This does not revert collision shapes that are merged with the parent shape. To do this, see “Undo the merging of multiple collision shapes with the parent shape”.

Delete the collision shapes for certain joints

In the Agent Collision Layer viewer state:

  1. Select the shape or joint.

  2. click and select Delete.

On the Agent Collision Layer SOP, the Joint Group parameter is updated to list the joints without collision shapes (the joint names are preceded with a ^).

Restore the collision shapes that were deleted

In the Agent Collision Layer viewer state:

  1. Press Z to enter the Restore from Groups mode. The joints with deleted collision shapes are available to be selected.

  2. Select the joints.

  3. click over the viewport and select Restore.

  4. Press Z again to exit the Restore from Groups mode.

Change the algorithm used for generating a convex hull shape

In the Agent Collision Layer viewer state:

  1. Select the shape or joint.

  2. On the top toolbar, select from the Algorithm drop-down menu.

    or

    Press G over the viewport to bring up the shape options HUD. From the Algorithm drop-down menu, select Shrinkwrap or Convex Decomposition, and adjust the Max Concavity (if Convex Decomposition is selected).

    or

    Press P over the viewport to bring up the collision shape parameters window. In the Viewer State Dialog tab, select from the Algorithm drop-down menu, and adjust the Max Concavity (if Convex Decomposition is selected).

Create a custom collision shape

See create custom collision shapes.

Orient a basic collision shape towards a joint

See orienting and positioning basic shapes.

Automatically position basic collision shapes

See orienting and positioning basic shapes.

Mirror a collision shape on the other side of the character

In the Agent Collision Layer viewer state:

  1. Select the shape you want to mirror.

    To see whether the shape can be mirrored, look at the viewer state hints (press ⇧ Shift + F1). If Mirroring is set to Success, the shape can be mirrored.

  2. click over the viewport and select Mirror.

Manually adjust the position, orientation, and scale of collision shapes

In the Agent Collision Layer viewer state:

  1. Select the shape you want to adjust.

  2. Turn on Enable Handle, and use the handle to translate, rotate, and scale the shape.

    or

    Press P over the viewport to bring up the collision shape parameters window. In the Viewer State Dialog tab, adjust the Translate, Rotate, Scale, Pivot Translate, and Pivot Rotate values.

Revert updates that were manually made to the collision shape transforms

In the Agent Collision Layer viewer state:

  1. Select the shape or joint.

  2. click over the viewport and select Reset Transform. Reset Transform only reverses updates that were made with the shape transform handle.

Cycle through the different transform handle modes

In the Agent Collision Layer viewer state:

  1. Select the shape or joint.

  2. On the top toolbar, turn on Enable Handle.

  3. Press Y over the viewport to cycle through the different transform handle modes.

Create one collision shape that encapsulates multiple joints

  1. In the Agent Collision Layer viewer state, select the shapes/joints.

  2. click and select Merge Convex Hull with Parent.

Undo the merging of multiple collision shapes with the parent shape

In the Agent Collision Layer viewer state:

  1. Press Z to enter the Restore from Groups mode. The joints that have been merged are available to be selected.

  2. Select the shape or joint.

  3. click over the viewport and select Restore Convex Hull.

  4. Press Z again to exit the Restore from Groups mode.

or

On the Agent Collision Layer SOP, Generate Shapes section, Generate Shapes Group parameter, remove the relevant joints preceded with ^.

Display where collision shapes intersect

On the Agent Collision Layer SOP, turn on Display Intersections.

or

In the Agent Collision Layer viewer state, top toolbar, turn on Display Intersections.

The areas where non-adjacent collision shapes intersect each other are displayed in red. This is useful for highlighting potential problem areas that could affect the ragdoll solver when it tries to deal with overlapping shapes.

Fix collision shape intersections

In the Agent Collision Layer viewer state:

  1. Select the shape you want to adjust.

  2. Turn on Enable Handle, and use the handle to translate, rotate, and scale the shape.

Import collision shapes from KineFX

It is also possible to create a collision layer from existing shapes, such as those from the second output of the Ragdoll Collision Shapes node.

  1. In the agent setup geometry network, add an Agent Layer node.

  2. Wire the collision shape geometry into the second input of the Agent Layer node.

    • The shape geometry is expected to contain rigidly-skinned packed primitives with the collision shape for each joint. See the adding static shapes page for more information.

  3. Set the Layer Name for the new layer.

  4. Enable Set Collision Layers to assign the new layer as the agent’s collision layer.

Joint limits

The Agent Configure Joints node provides an interactive way of setting joint limits for the agent’s skeleton. The joint limits control the range of motion for each joint when simulated as a ragdoll (for example, preventing the character’s elbow from bending backward).

Tip

For ragdolls, rotation limits are only necessary for joints which have a collision shape. Any other joints are not modified by the solver and maintain their existing local transforms.

If the agent’s collision layer is created before configuring joint limits, you can turn on Filter Joints with Colliders to hide joints which don’t have a collision shape. This can be useful in the viewer state to prevent selecting joints which don’t require rotation limits.

The joint limits are created in the Agent Configure Joints viewer state:

  1. In the agent definition network, select the Agent Configure Joints node and turn on its display flag.

  2. Press Enter over the viewport, or click on the left toolbar to enter the Agent Configure Joints viewer state.

  3. By default, the Rotation Limit Display option on the top toolbar is turned on, so if you select a joint, its rotation limits are displayed.

    Select a joint and adjust the rotation limit handles:

    Set joint rotation limits

    Note

    Currently, the ragdoll solver doesn’t support translation limits for joints.

  4. To see whether the joints are outside their limits:

    • On the Agent Configure Joints SOP, turn on Display Joints Outside Their Limits.

      or

    • In the Agent Configure Joints viewer state, on the top toolbar, turn on Display Joints Outside Their Limits.

    The sphere at the joint turns red when the joint is outside its limits.

    Joint limits indicator

    Joint limits apply in local space. If the parent of the joint is moved, the limits follow along with the parent, but if the joint itself is moved, then the limits apply.

Compute joint limits from clip

The Agent Configure Joints SOP can automatically compute joint limits based on the poses from an agent clip. For best results the clip should demonstrate a suitable range of motion for the agent, but the computed limits can be adjusted further in the viewer state.

  1. Ensure that the agent definition has an animation clip to use for computing joint limits. For example, add an Agent Clip node upstream of the Agent Configure Joints SOP and load an animation clip from a file.

  2. On the Agent Configure Joints SOP, turn on Compute Limits for Joints from Clip.

  3. Set the Clip Name parameter to the name of the agent clip to use.

  4. Optionally, set the Joint Group parameter in the Compute Limits for Joints from Clip section to the group of joints you want to compute joint limits for.

  5. Enter the Agent Configure Joints viewer state to view the computed limits:

    Joint limits computed from clip

How-to

To...Do this

Display the handles for all joints that have limits

On the Agent Configure Joints SOP, turn on Display Rotation Limits in the Guide Geometry section.

or

In the Agent Configure Joints viewer state, turn on Show All Handles and Rotation Limit Display.

Display only the selected rotation limits

In the Agent Configure Joints viewer state:

  1. Turn off Show All Handles.

  2. Turn on Rotation Limit Display.

  3. Select the joint(s).

Adjust the joint limits

In the Agent Configure Joints viewer state:

On the top toolbar, turn on Show All Handles and adjust the joint limit handles.

or

Select a joint, and press G over the viewport to bring up the limit values HUD.

or

Select a joint, and press P over the viewport to bring up the joint limit parameters window. In the Viewer State Dialog tab, adjust the X Angle Range, Y Angle Range, and Z Angle Range values.

Only set limits on certain joints

In the Agent Configure Joints viewer state:

  1. Select the joint(s) you don’t want to set limits for.

  2. click and select Delete.

On the Agent Configure Joints SOP, the Joint Group parameter is updated to list the joints that don’t have limits set (the joint names are preceded with a ^).

Copy and paste joint limits

In the Agent Configure Joints viewer state:

  1. Select a joint and press ⌃ Ctrl + C to copy its limits.

  2. Select another joint.

  3. Press ⌃ Ctrl + V to paste the limits.

Mirror joint limits

In the Agent Configure Joints viewer state:

  1. Select the joint you want to mirror.

    To see whether the joint can be mirrored, look at the viewer state hints (press ⇧ Shift + F1). If Mirroring is set to Success, the joint can be mirrored.

  2. click over the viewport and select Mirror. The handle will point in the same direction as the original joint.

Flip the display of the rotation limits handle

In the Agent Configure Joints viewer state, select the joint and press ⇧ Shift + F.

Delete all configured joint limits

On the Agent Configure Joints SOP, click Clear Overrides.

Delete specific joint limits

In the Agent Configure Joints viewer state:

  1. Select the joint(s).

  2. click and select Remove Override.

Reset joint limit values

In the Agent Configure Joints viewer state:

  1. Select the joint(s).

  2. Press G over the viewport to bring up the limit values HUD.

  3. Click Clear.

Enable/Disable joint limits

In the Agent Configure Joints viewer state:

  1. Select the joint.

  2. Press F over the viewport to bring up a HUD, and turn on/off Rotation Limits.

    or

    Press P over the viewport to bring up the joint limit parameters window. In the Viewer State Dialog tab, turn on/off Enable R Limits.

If you turn off Enable R Limits, the joint no longer has a limit assigned to it. The limit values will not be written out to the agent’s metadata dictionary, and the limit handle will not be displayed in the Agent Configure Joints viewer state. However, the limits are not deleted, and can be made active again by turning on Enable R Limits.

Display the joints that are outside their limits

On the Agent Configure Joints SOP, turn on Display Joints Outside Their Limits.

or

In the Agent Configure Joints viewer state, on the top toolbar, turn on Display Joints Outside Their Limits.

Extend the limits for joints that are outside their limits

In the Agent Configure Joints viewer state:

  1. Select the joint that is outside its limits.

  2. Press G over the viewport to bring up the limit values HUD.

  3. Click Extend Limits From Pose.

Change the size of the joint limits guide geometry

On the Agent Configure Joints SOP, adjust the Guide Geometry Scale.

Import joint limits from KineFX

When creating an agent from a KineFX skeleton, joint limits can be imported from a dictionary attribute on the skeleton joints.

  1. Use the Configure Joint Limits or Configure Joints node to configure limits for the skeleton.

    This stores the limits in a dictionary point attribute on the skeleton geometry, with the attribute name specified by the Output Configuration Attribute parameter.

  2. Append an Agent from Rig node after the Configure Joint Limits node.

    Set the Joint Config Attributes parameter to include the name of the dictionary point attribute on the skeleton geometry. The joint configurations will be imported into the agent’s metadata dictionary.

Joint groups

Create named groups of joints on the agent so that you can apply ragdoll effects to some parts of the agent and not others.

  1. Place an Agent Transform Group SOP after the Agent Configure Joints SOP.

  2. In the parameter editor, use the Transform Groups multiparm to create new groups. For each group:

    • Set the Name to the name of the joint group. For example, upper_body.

    • In Root Transforms, select the root joint(s) for the group. Each root and its descendants will be added to the group.

    • To control how much the ragdoll effects (such as stiffness) apply to the root versus the “outermost” joints, turn on Blend into Group.

    • To see the joints that are part of the group, turn on Show Guide Geometry, which displays spheres around the selected joints. You can change the size of the spheres on the Guides tab. Display the agent as Wireframe to more easily see the guide geometry.

    Guide geometry displayed for the left leg joint group

Import joint groups from KineFX

When creating an agent from a KineFX skeleton, joint groups can be imported from point groups or float attributes on the skeleton joints.

  1. Use a node such as Group Create to create a point group on the skeleton geometry.

  2. Append an Agent from Rig node after the group node.

    Set the Point Groups parameter to include the name of the point group on the skeleton geometry. For each specified point group, an agent transform group with the same name will be created from the joints in the point group.

    or

    Set the Float Point Attributes parameter to include the name of a float attribute on the skeleton geometry. For each joint with a value greater than zero, the joint will be included in the agent transform group and will use the attribute’s value as its weight.

Testing

Place a Test Simulation Ragdoll node after the Agent Collision Layer, Agent Configure Joints, or Agent Transform Group node. Turn on the display flag of the Test Simulation Ragdoll node, and click Play in the playbar to play a simple simulation of the agent in a ragdoll state with gravity.

Tip

This node can help you figure out whether the joint limits have been set up correctly. Turn off the Allow Initial Violation of Limits parameter in the Constraints tab. If the skeleton’s initial state is outside the joint limits when you start the simulation, the joint(s) will immediately pop, showing you where there is an issue.

To...Do this

Test how the agent reacts when you throw it in different directions

  1. Set the initial velocity in the Test Simulation Ragdoll node’s Initial Velocity parameter.

  2. Click Play in the playbar to play a simulation of the agent.

Ragdolls in DOPs

In the crowd simulation network, you can set the states when agents are ragdolls, and the triggers that cause the agents to become ragdolls.

Crowd simulation DOP network for ragdoll

Ragdoll state

Choose to make agents in a particular state become ragdolls by setting the Crowd State DOP RBD Ragdoll parameter to one of the following:

Active

Agents are simulated as ragdolls, as opposed to following an animation clip.

Animated Static

Agents are not ragdolls; their motion follows an animation clip. They can affect other simulated objects (for example, kicking things around as they walk), but simulated objects do not affect the agent.

Ignore

Agents are not ragdolls, and no rigid body dynamics objects will collide against the agents.

See the Crowd State DOP for more information.

Trigger to ragdoll state

Set the trigger that causes the agents to become ragdolls with the Crowd Trigger DOP. This could be used, for example, to change walking agents to ragdolls when they are hit by a boulder.

To...Do this

Trigger a state transition when an agent is hit by an RBD object

  1. Set the Crowd Trigger DOP parameter Type to RBD Impact Data.

  2. Specify a list of RBD objects that can activate the trigger in the DOP Impact Objects parameter.

  3. Specify how strong the impact must be for the trigger to activate in the Impact Threshold parameter.

Trigger a state transition when agents collide with other agents

Set the crowd object (crowdobject in the above network) as one of the objects in the Crowd Trigger DOP Impact Objects parameter.

Ragdoll effects

When agents are in the ragdoll state (RBD Ragdoll parameter set to Active on the Crowd State DOP), you can apply effects to the agents such as:

  • Sticky collisions - Configure objects to stick to agents during a collision.

  • Stiffness - Control the resistance to changes in the agent’s pose.

  • Partial ragdoll - Part of the agent can be simulated while the rest follows an animation clip.

  • Motors - Joints can be partially driven by an animation clip, but still react to simulation forces.

See the Crowd State DOP for more information.

Sticky collisions

Consider the scenario where arrows are being shot at a crowd of agents. When the agents are hit, they turn into ragdolls and fall to the ground. In this case, you would want the arrows to stick to the agents, and not bounce off and fall away. This is where sticky collisions come in.

Sticky collisions can be configured for each state that the agents are in. For example, you can configure sticky collisions such that the arrows stick to the agents when they are walking, but not when they are in a ragdoll state. This is done by setting the sticky collisions parameters in the Crowd State DOP.

You can also trigger new agent behavior (trigger a new state) based on the number of sticky collisions that have occurred on an agent. The Crowd Trigger DOP has an option that counts the number of sticky collisions that have occurred on an agent, and uses it to trigger new behavior.

In the video below, arrows that hit the agents get stuck onto the agents. When an agent is hit with two sticky collisions, they transition from a walking state to a ragdoll state.

Sticky collisions

Sticky collisions is also a feature on the bullet solver. So in our example above, the agents can be sticky, but the arrows can also be sticky. You can configure RBD objects (arrows) to be sticky using the RBD Configure SOP. If you have sticky collision settings on multiple objects, the settings can override each other. For example, the object with the higher collision impact threshold would take precedence. See sticky collisions on the bullet solver for more information about the sticky collision settings that are shared between the RBD Configure SOP and the Crowd State DOP.

To...Do this

Set specific parts of the agent to be sticky

On the Crowd State DOP under the Sticky Collisions section, set the Group parameter to the name of the group of joints you want to be sticky. See joint groups for how to create groups of joints on the agent.

Control the stickiness of the agents

On the Crowd State DOP, the Min Collision Impulse parameter defines the minimum impact from a collision that will cause an object to stick to the agent. A higher number makes it harder for an object to stick to the agent.

Min Collision Impulse must be set to a value greater or equal to 0 for objects to stick to the agent.

Restrict the number of objects that can stick to each agent

On the Crowd State DOP, set Max Collision Objects per Shape to the number of objects that can stick to each collision shape on the agent joint group that is specified as being sticky. See collision shapes for defining collision shapes for an agent.

To visualize the collision shapes on the agents, on the Crowd Object DOP under the Bullet Data tab:

  • Turn on Show Guide Geometry.

  • Turn off Display Geometry to more easily see the guide geometry.

For example, if the upper_body joint group is specified to be sticky (Crowd State DOP under Sticky Collisions, Group is set to upper_body), and Max Collision Objects per Shape is set to 2, then only 2 objects can stick to each collision shape on an agent’s upper body. Note that objects can still stick to other collisions shapes in the agent’s upper body.

In the image below, collision shapes are shown for an agent’s upper body. If Max Collision Objects per Shape is set to 2, the bottom red arrow would not stick to the agent, because it will hit the same collision shape that already has 2 objects stuck to it.

Objects colliding with a collision shape

Avoid swinging objects

By default, the bullet solver creates glue constraints for sticky collisions, which produces a perfectly rigid attachment between the colliding objects. If you switch the constraint type to a soft constraint, this would allow an object that hits an agent to swing around the anchor (contact) point. To avoid this behavior, increase Max Collision Points on the Crowd State DOP to add more contact points between the object and agent.

Only allow specific objects to stick to the agents

On the Crowd State DOP, set Collision Ignore to the objects you don’t want to stick to the agents. The objects listed here will collide with, but not stick to, the agents.

You can specify the following in Collision Ignore:

  • A list of objects to ignore - these objects will not stick to the agents.

  • A wildcard (*) ignores all objects - no objects will stick to the agents.

  • Objects preceded by the caret character (^) will still stick to the agents. For example, “* ^projectiles” specifies that only projectiles will stick to the agents.

Trigger a new behavior based on the number of sticky collisions that have occurred on an agent

  1. On the Crowd Trigger DOP, set Type to RBD Sticky Collisions.

  2. In Transform Group, set the joint group(s) on which to count the number of sticky collision occurrences.

  3. Set the Number of Sticky Collisions and the Comparison method to specify the criteria that triggers the agent to change to another state.

For example, if Transform Group is set to upper_body, Comparison is set to Equal, and Number of Sticky Collisions is set to 2, then when 2 objects have collided and stuck onto an agent’s upper body, a state transition will occur. The state that the agent transitions to is specified in the Crowd Transition DOP that comes after the Crowd Trigger DOP in the crowd simulation network.

In the below image, the green agents are in the walking state and have not been hit on the upper body with 2 sticky collisions. A few frames later on the right, the yellow agents have been hit on the upper body with 2 sticky collisions and have become ragdolls.

Yellow agents on the right become ragdolls when hit with two sticky collisions

Troubleshooting

In the video below, the constraints holding the ragdoll agents together are disabled when the walking agents collide with the ragdoll agents. Sticky collisions are turned on for the walking agents.

Unexpected result when agents collide with each other

Glue constraints are created by the bullet solver for sticky collisions. When the agents collide, the bullet solver creates glue constraints to stick the agents to each other.

When the glue constraints are created, they are added to one of the constraint networks within the DOP crowd simulation network. Constraint networks define the pairs of rigid body objects that should be constrained together. In this case, the DOP network contains two Constraint Network DOPs - ragdoll_constraints and rbd_to_agent_constraints.

Constraint Network DOPs in the crowd simulation network

ragdoll_constraints constraint network

Defines the constraints between the agents. Does not have a glue constraint wired into its 2nd input (we will see why this is important later).

rbd_to_agent_constraints constraint network

Defines the constraints between the arrows and agents. Has a glue constraint wired into its 2nd input.

The bullet solver’s logic for deciding the constraint network to add the sticky collision constraints to is controlled by the Sticky Collisions parameters on the Bullet Solver DOP. (In the network above, the bullet solver is the Rigid Body Solver DOP (rigidbodysolver1) with its Solver Engine parameter set to Bullet.)

In this example, the bullet solver added the sticky collision constraints to the ragdoll_constraints constraint network, because:

  • The collision was between two rigid bodies (agents) that were both in the crowd object (crowdobject1)

    and

  • The Use Internal Constraint Networks parameter on the bullet solver was turned on. This caused the sticky collision constraints to be added to the constraint network (ragdoll_constraints) between the colliding objects (agents).

Constraint networks need to have the appropriate constraint type wired into its 2nd input. In this case, the glue contraints created from the sticky collisions were added to the ragdoll_constraints constraint network, but ragdoll_constraints did not have a glue constraint wired in (unlike rbd_to_agent_constraints). This caused an error on ragdoll_constraints, which in turn, disabled the conetwist constraints that were holding the ragdoll together.

Solutions

There are a few solutions, depending on the behavior you want:

  • If you don’t want the agents to stick together, set the walking agents to ignore collisions with other agents - in the Crowd State DOP for the walk state, set Collision Ignore to crowdobject1 (the agents).

  • If you want all the sticky collision constraints (between an arrow and agent, and between two agents) to be in the rbd_to_agent_constraints constraint network, turn off Use Internal Constraint Networks on the bullet solver. Otherwise, the sticky collision constraints will be added to ragdoll_constraints.

    If you have additional constraint networks in your DOP network, explicitly specify that the sticky collision constraints are to be added to rbd_to_agent_constraints by setting External Constraint Network on the bullet solver to rbd_to_agent_constraints.

  • If you want the sticky collision constraints between two agents to stay in the ragdoll_constraints constraint network, either wire in a glue constraint into the 2nd input of ragdoll_constraints, or add a SOP solver to switch the new sticky collision constraints to another constraint type, like hard or soft constraints.

Note

Deciding which constraint network to put the sticky collision constraints in is a workflow choice. However, in the above example, the Attach Internal Constraints to Objects parameter in the ragdoll_constraints constraint network is turned on by default, which means that ragdoll_constraints can only contain constraints between two agents, and not constraints between an arrow and an agent.

See bullet solver and constraint network for more information.

Stiffness

When stiffness is turned on, agents try to keep their current pose once they become ragdolls. When stiffness is turned off, agents have a floppy behavior in their ragdoll state.

Stiffness turned off
Stiffness turned on
To...Do this

Turn on stiffness

  1. On the Crowd State DOP, set RBD Ragdoll to Active.

  2. Turn on the Stiffness section parameter.

Increase stiffness

On the Crowd State DOP under the Stiffness section, increase the Stiffness parameter.

The Stiffness parameter is available when Stiffness Value is set to Constant.

Increase the stiffness for specific parts of the agent

On the Crowd State DOP under the Stiffness section, set the Group parameter to the group of joints you want to increase the stiffness for. See joint groups for how to create groups of joints on the agent.

Control the stiffness over the first few seconds that the agents are in the current state

  1. On the Crowd State DOP under the Stiffness section, set Stiffness Value to Ramp.

  2. Set Time Range to the start and end times (in seconds) that you want to introduce stiffness into the agents. The Time Range start/end times correspond to the start/end of the Stiffness Ramp.

    For example, if you set Time Range to 0.0 and 5.0, the Stiffness Ramp lets you control the stiffness over the first 5 seconds the agent is in this state. Outside this range, the ramp extends the first and last values.

  3. Adjust the stiffness:

    • Use the Stiffness Ramp to adjust the stiffness at each point in the Time Range.

    • The Stiffness Scale scales the values of the Stiffness Ramp.

Partial ragdoll

With partial ragdoll turned on, you can specify part of the agent to be a ragdoll, while the rest of the agent follows an animation clip. For example, you can have the lower body animated by a walking clip, while the upper body is a ragdoll and reacts to hits from simulated objects.

In the below video, the agents' upper bodies becomes ragdolls once the upper body is hit with a sticky collision, while the lower body continues walking based on an animated walking clip.

Partial ragdoll - ragdoll upper body with animated walking lower body
To...Do this

Specify certain parts of the agent to be a ragdoll

  1. On the Crowd State DOP, set RBD Ragdoll to Active.

  2. Turn on the Partial Ragdoll parameter.

  3. Set the Active Group parameter to the group of joints you want to turn into ragdoll. See joint groups for how to create groups of joints on the agent.

Specify the animation clip to play for the non-ragdoll part of the agent

  1. On the Crowd State DOP, set RBD Ragdoll to Active.

  2. Turn on the Partial Ragdoll parameter.

  3. Under the Clips section, set Clip Assignment to Single Clip.

  4. Specify the animation clip to play in Clip Name.

Increase the speed of the animation clip

  1. On the Crowd State DOP, set RBD Ragdoll to Active.

  2. Turn on the Partial Ragdoll parameter.

  3. Under the Clip Playback section, increase the Clip Speed Multiplier.

Tip

If the agent’s feet appear to slide around once they transition to the ragdoll state, change the Type to Locomotive under the Clip Playback section. This will cause the agent’s movement to be guided by the clip’s locomotion data. If Type is set to In-Place, the agent’s movement is driven entirely by the underlying particle, which could cause the agent’s foot placement to slide around instead of being planted on the ground with each step.

Motors

When the motors effect is turned on, the agent joints are partially driven by an animation clip, but will still react to simulation forces.

In the below video, once the agents turn to ragdolls, their legs are still partially driven by the walking animation clip.

Motors effect
To...Do this

Turn on the motors effect

  1. On the Crowd State DOP, set RBD Ragdoll to Active.

  2. Turn on the Motors parameter.

Increase the effect of the animation clip

On the Crowd State DOP under the Motors section, increase the Motor Strength parameter.

The Motor Strength parameter is available when Strength Value is set to Constant.

Specify certain parts of the agent to be driven partially by an animation clip

On the Crowd State DOP under the Motors section, set the Group parameter to the group of joints you want to be partially animated by the clip. See joint groups for how to create groups of joints on the agent.

Control the effect of the animation clip over the first few seconds that the agents are in the current state

  1. On the Crowd State DOP under the Motors section, set Strength Value to Ramp.

  2. Set Time Range to the start and end times (in seconds) that you want to control the effect of the animation clip. The Time Range start/end times correspond to the start/end of the Strength Ramp.

    For example, if you set Time Range to 0.0 and 5.0, the Strength Ramp lets you control the effect of the animation clip over the first 5 seconds the agent is in this state. Outside this range, the ramp extends the first and last values.

  3. Adjust the effect of the animation clip:

    • Use the Strength Ramp to adjust the effect of the animation clip at each point in the Time Range.

    • The Strength Scale scales the values of the Strength Ramp.

Detaching limbs (advanced)

  • The Agent Constraint Network node in the crowd source geometry network creates a set of polylines representing every constraint for every joint on every agent. The ragdoll_constraints Constraint Network DOP in the crowd simulation network imports these constraints into the simulation, and the bullet solver applies forces to maintain the constraints.

    You can append a SOP Solver to the multisolver to modify the constraints as part of the simulation (such as deleting constraint lines to detach limbs). The constraints are stored in the crowd object’s ConstraintGeometry subdata, so the SOP Solver’s Data Name parameter should be set to ConstraintGeometry instead of the default value (Geometry).

  • If you have agents that are ragdoll (RBD Ragdoll parameter on their state is set to Active) or can potentially switch to ragdoll (RBD Ragdoll is set to Animated Static), the ragdoll solver adds attributes to the constraints you can use to trigger constraint changes.

    click the relationship_geometry node in the SOP solver network and choose Spreadsheet to see the attributes.

  • The torque primitive attribute contains the force the solver had to use to maintain the constraint in the current timestep (in other words, the amount of force on the joint).

    To detach limbs upon impact, set up a primitive wrangle that deletes constraint lines where the torque is above a certain limit:

    if (f@torque > 50)
        removeprim(0, @primnum, /* andpoints */ 1);
    
  • If you have deforming geometry on the agent, the detached part will move away, but the skin will stretch over the detached part. You need to switch to an alternate layer with separate skin geometry for detached agents.

Crowd simulations

Getting started

  • Basics

    An overview of Houdini crowd simulation concepts.

  • Setup

    How to set up and edit a crowd simulation.

The moving parts

  • Agents

    About agents, the moving actors that make up a crowd simulation.

  • States

    About agent states, the virtual mood of each agent that controls the agent’s animation and the behaviors it runs.

  • Triggers

    How to specify conditions that cause agents to change from one state to another.

  • Caches

    Tips for efficiently caching and loading crowd sims.

Behavior

Appearance

  • Diversity

    How to create a more realistic crowd by making agents look and act differently.

  • Attaching cloth

    You can add and constrain vellum cloth as part of agent shape geometry, and then simulate the cloth based on agent movements.

Terrain

  • Foot planting

    How to set up agents to adapt their animation to terrain and prevent skating.

  • Terrain

    How to specify terrain geometry for agents to walk across.

  • Obstacles

    How to set up obstacles for agents to avoid.

SOP crowds

Crowd Procedural