CrowdSim3D

When settings up a crowd simulation the next steps are important.

  1. Prepare your model. During the preparation you can configure the materials, textures, meshes, actions and thus create the variations that you want.
  2. Add agents to your scene. Agents are the actors in a crowd simulation. An agent represents a single instance of your model with a specific variation and behavior.
  3. Add behavior to your agents.
  4. Run the crowd simulation.

This chapter describes how you can perform these steps using CrowdSim3D.

Prepare a model

Before you can use a model in CrowdSim3D you need to enable the CrowdSim property for that model.

Enable crowd simulation

To enable the crowd simulation for a model:

  • Select the object you want to use in the crowd simulation.

  • Go to the Object tab.

    ../../_images/object-tab.png
  • In the Object tab there is a panel named CrowdSim. Enable CrowdSim by ticking the checkbox of the CrowdSim panel

    ../../_images/crowdsim-checkbox600x67.png

Note

Using armatures

If your object has an armature and you want to use the armature in the simulation, then you will need to enable the crowd simulation on the armature an not on the model.

When you have enabled the crowd simulation on an armature, you have the ability to define characters and perform mesh variations. If you want to know more about this subject, please have a look at Character variations.

Character variations

If you are using an armature you can define characters. A character is a configuration of meshes you want to use in your crowd. It is possible to create multiple characters for a single armature. It is also possible to configure what variations of meshes are allowed when using a character.

Note

Character variations can only be defined for armatures. If your model is not an armature you can skip this step and continue with Material variations.

You can configure the characters using the Node Editor.

../../_images/node-tree-character-overview.png

Creating multiple characters

In the Node Editor you can create multiple characters based on your Armature. The appearances of a character can be configured by showing or hiding meshes.

Nodes

The following nodes can be used to define characters:

Armature node

With this node you can select an armature and add one or more character definitions to the armature.

../../_images/node-armature-select-armature.png

With ‘Add Character’ you can add another character configuration for the chosen armature.

You can remove a character by clicking the ‘-‘ button next to that character. All connected nodes are not removed, only disconnected.

Note

Naming

Name your characters well. The name is displayed when populating or adding behavior.

Mesh node

With this node you select the meshes that are part of your character or Mesh Group.

../../_images/node-mesh.png

In the above image when you use Judy_Rig model in combination with the At Work character all meshes in the mesh node will be used.

By pressing ‘Add Mesh’ you can add another mesh. By pressing the ‘-‘ button next to a mesh you will remove the mesh from the node. The mesh itself is not deleted.

Mesh Group node

With this node you can create variations of meshes for a character. You define a mesh group, give it a name. Each group can have a set of meshes by using a Mesh node node or other groups.

The weighted option defines all the mesh groups that should be evaluated or not. You can use this to configure a Mesh variation option for the character.

  • When weighted is checked only one group will be evaluated. The crowdsim can variate on the group.
  • When weighted is unchecked, all groups will be evaluated.

For example, the next image shows a character configuration.

../../_images/node-mesh-group-example.png

When an agent uses the Judy_Rig model and the At Work character, it will show two mesh variations:

  • With Belt / Without Belt: adds 2 optional meshes to the agent (Belt, BeltBuckle).
  • With Tail / Without Tail: adds 1 optional mesh to the agent (Tail).

The meshes connected to the mesh group named Default will always be added to the agent as it has no Weighted option enabled.

Note

Multiple weighted mesh groups in a chain

It is not supported to have multiple weighted mesh groups in a chain. When you configure the character with multiple weighted mesh groups in a chain the violating mesh groups will be highlighted in a red color.

../../_images/node-mesh-group-chained-weighted.png

To fix this, you need to setup your weighted groups such that from the Armature node to any Mesh Node only one Mesh Group Node is present with the Weighted option checked.

Note

Name your mesh groups well

Name your mesh groups well as the names are used when populating or adding behavior to your scene.

Material variations

Once your model is prepared you can create material variables. You declare a variable and it’s type and assign material nodes to it.

CrowdSim3D supports Cycles node based materials. You can add variations on Value, RGB and Image Texture nodes.

Note

Material variations added to armatures also apply to the meshes connected to the character.

Where

In the Properties Space ‣ Object tab ‣ CrowdSim you can define Material Variables.

Creating a material variable

To create a material variable, press Add Material Variable.

../../_images/object-panel-crowdsim-add-material-variable.png
Name
First give your variable a name. Use a recognizable name as this name will also be displayed when using this material variable during population.
Type

You can create 3 types of variables:

  • Value. Selecting this type will vary the value of Value nodes.
  • Color. Selecting this type will vary the colors of RGB nodes.
  • Image. Selecting this type will vary the textures of Image Texture nodes.

Type: Value

../../_images/object-panel-crowdsim-material-variable-value.png

When creating a Value Material Variable you can set the:

  • Range. This configures the minimum and maximum allowed value.
  • Default. This sets the default value for this material variable.
  • Uniform. The values for the Range and Default are real numbers eg 0, 1, 2, 3. If you need fractional numbers you can enable uniform. Uniform will divide the value with the range.

Type: Color

../../_images/object-panel-crowdsim-material-variable-color.png

When creating a Color material variable you can:

  • Add material colors. The selected colors will be used as variations.

Type: Image

../../_images/object-panel-crowdsim-material-variable-image.png

When creating an Image material variable you can set the:

  • Range. This configures the minimum and maximum allowed value.
  • Default. This sets the default value for this material variable.

Adding material nodes

You can add the nodes that will be effected by this material variable. To add a material node to your variable, press Add Material Node. Then select a material and the node.

Be sure that you select a node that is compatible for the variable type.

Compatible node types
Variable Type Node Type
Value ValueNode
Color RGB Node
Image Image Texture Node

In case of a Color material variable you can set the Option Use As Diffuse This will update the viewport color of the selected material as well.

In case of an Image material variable you should also set an Image name field. CrowdSim3D looks at this name and not the filename of the buffer. This field uses a pattern to select an Image Buffer from the Image Editor.

Naming Pattern

The pattern is a Python Formatting string, for example diffuse-{value:03}.png. Here the {value:03} will be replaced by the value selected for this material variable and pre-filled with zeros. When the value is 1 it will look for an Image Buffer with the name diffuse-001.png.

../../_images/image-buffers.png

You can keep multiple textures in sync by adding both Image Texture Nodes to the same Material Variable. This way you can variate the diffuse and bump texture of a material that belongs to each other.

Value and Selected Image Buffers.
Value diffuse-{value:03}.png bump-{value:03}.png
1 diffuse-001.png bump-001.png
2 diffuse-002.png bump-002.png
3 diffuse-003.png bump-003.png

Leading zeros

If you don’t need the leading zero’s you can use a pattern like: diffuse-{value}.png. That will select image buffers with the name diffuse-1.png, diffuse-2.png, etc. If you need more leading zeros you can change it like: diffuse-{value:05}.png.

Leading zeros
Pattern Value = 1 Value = 2
diffuse-{value}.png diffuse-1.png diffuse-2.png
diffuse-{value:02}.png diffuse-01.png diffuse-02.png
diffuse-{value:03}.png diffuse-001.png diffuse-002.png
diffuse-{value:04}.png diffuse-0001.png diffuse-0002.png

Escaping curly brackets

If you have curly brackets in your filename you can escape them by using two curly brackets. For example {{diffuse}}-{value:03}.png will select the image buffer with name {diffuse}-1.png.

Alignment and other options

Other options like alignment can be found at [https://docs.python.org/3.6/library/string.html#formatspec]

Adding agents

After you have configured your models and variables you are ready to add agents to the scene. Agents are like actors - placeholders. They connect the model and its behavior.

Adding agents

There are several ways to add agents to your scene:

  • You can add one agent.
  • You can add several agents using a plane.
  • You can add several agents using a circle.
  • You can add several agents using a triangle.
  • You can add several agents in a grid formation.
  • You can add several agents using a mesh.

You can have several of these distributions in your scene. Each distribution is identified by an Agent Factory object.

Where

You can add agents by pressing SHIFT + A, select Crowd Sim from the menu and then select a distribution.

../../_images/crowdsim-menu.png

Just an agent

When selecting this option an agent will be added to your scene.

../../_images/1-agent.png

Several agents using a Plane

With this option the agents will be added in a plane. You can scale the plane to fit the area you want the agents to be placed in.

../../_images/agents-plane-500x492.png

Several agents using a Circle

With this option the agents will be added in a circle. Scale the circle to fit the area you want the agents to be placed in.

../../_images/agents-circle-500x500.png

Several agents using a triangle

With this option the agents will be added in a triangle. Scale the triangle to fit the area you want the agents to be placed in.

../../_images/agents-triangle-500x500.png

Several agents using a grid

With this option the agents will be added in a grid formation. You can set the number of columns, rows and distance between the agents.

../../_images/agents-grid.png

Several agents using a mesh

With this option the agents will be added using an mesh. You can attach you own mesh to the factory.

../../_images/agents-mesh.png

Setting the number of agents

In the Object menu you will find a CrowdSim section.

Here you can set the number of agents for your scene.

../../_images/crowdsim-num-agents600x67.png

Select a distribution pattern

../../_images/num-agents-dist-pattern600x127.png

In the CrowdSim panel you can also select how you want your agents to be placed within the distribution:

  • Random: This pattern will randomly place agents on a plane, circle or triangle.
  • Grid: This pattern will place agents randomly using a grid.
  • Quincunx: This pattern will place agents randomly using a quincunx.
../../_images/dist-pattern-menu.png

Grid distance

With this option you can set the distance between the agents.

../../_images/crowdsim-num-dist-grid600x160.png

Lock Location and Rotation

If you have already set up your scene with agents and you want to add more agents, with this feature you can configure that the distribution settings are only applied to the newly added agents.

Locking the location and/or rotation will not change the location or rotation of the agents already in your scene.

../../_images/crowdsim-num-dist-random-lock600x240.png

Facing Direction

This field sets the direction that the agents should face. This field contains two lines:

  • With the 1st row you set the facing direction of all agents.
  • With the 2nd row you set the random factor within the facing direction.
../../_images/crowdsim-num-dist-random-lock-facing600x320.png

Random location

In the case of a Grid or a Quincunx distribution pattern you can also set the randomness in one of the axis.

../../_images/crowdsim-num-dist-grid-lock600x373.png

Instantiate agents

If you set one of the above fields the set of agents is automatically updated. However if you are not satisfied with how the agent distribution is rendered you can render another distribution by pressing this button.

../../_images/crowdsim-num-dist-random-lock-facing-instantiate600x360.png
Lock

This option let’s you lock and agent. A locked agent will not be updated during a population.

See Populate Agents for more information.

Base model
This option let’s you select an object or an armature as model for your agent.
Initial Speed
With this option you can set the initial speed of your agent.
Normal Speed
With this option you can set the normal speed of your agent.
Maximum Speed
With this option you can set the maximum speed of your agent.
Acceleration
With this option you can set the acceleration of your agent.

Populate Agents

Once you have set up your Material and Character variables and have agents in your scene, you can “Populate” your agents. This process will distribute your models and select characters, materials and properties for your agents.

You can populate agents in two ways:

  • Automatic selection using the Populate in the Node Editor.
  • Manual selection via Properties ‣ Object tab ‣ CrowdSim Materials/CrowdSim Character.

Automatic selection

Assign variables to your agents

Once you have created your mesh variables you can apply these variables onto your models. This is done using the Node Editor.

  • Go to the Node Editor.

  • Add a new CrowdSim node tree or use an existing one.

  • Add a Populate node to the node tree. Select the model you want to apply to the agents.

  • Connect a Mesh Variable, Material Variable or Agent Variable node to the Variances socket of the populate node.

    ../../_images/crowdsim-nodetree-populate.png
  • When connected the nodes displays the Material Variables and Mesh variables of the model in the node.

    In the Mesh Variable node you can select the weights for the characters and the weighted mesh groups the model has.

    In the Material Variable you can enable material variables to be populated and the range.

  • After pressing Populate of the Populate node all agents in the scene will get random mesh/material variables.

    You can use the Object Selector node and connect it to the Agents socket of the populate node to limit the affected agents.

Note

  • After Automatic selection you can still change the model, character, meshes and materials per agent. See Manual selection for more information.

  • Agents that are locked will not get new values for characters and meshes. They will keep the values they already have.

    ../../_images/crowdsim-panel-lock.png

Manual selection

When using manual selection you can only modify a single agent at a time.

Changing the model of an agent

You can change the model of the selected agent in the Properties ‣ Object tab ‣ CrowdSim panel.

../../_images/agent-config.png

Change the Base Model to change the model of the agent.

Changing the mesh variable of an agent

You can change the character and meshes of an agent in the Properties ‣ Object tab ‣ CrowdSim Character panel.

../../_images/object-panel-crowdsim-character.png

Changing the material variable of an agent

You can change the materials of an agent in the Properties ‣ Object tab ‣ CrowdSim Material panel.

../../_images/object-panel-crowdsim-material.png

Note

Tips

  • Keep the range of material variables small. For every combination of material variations a copy of the material is created. When you have a lot of options or a large range it will influence the render performance.

    In Blender a material is part of the mesh data so even complete meshes are copied.

  • When linking a model from another blend file, make sure you link in the Images you want to variate. Otherwise these cannot be found. Most of the time it is enough to load the Character Configuration (Node tree with the character node) and the images.

Populate

This section describes the nodes that can be used for populating your agents. These nodes can be found in the Populate category in the node editor.

Populate

../../_images/node-populate.png

With this node you can select the models for your crowd simulation. You can create several variances of this model by attaching Material and Mesh Variables to this node. You can also configure the agent(s) properties with the Agent Variable node.

Agent Variable

../../_images/node-agent-variable.png

With this option you can variate speed and acceleration and other properties of your character.

Options to variate:

  • Initial Speed: Initial speed of the agent
  • Normal Speed: Speed considered the normal speed of the agent
  • Maximum Speed: The maximum speed of the agent
  • Acceleration: The Acceleration of the agent
  • Mass: The mass of the agent. Intersection uses this to calculate the impact of the collision.
  • Radius: The radius of the agent.
  • Animation Offset: The animation offset of the agent.

Material Variable

../../_images/node-material-variable.png

Configure which material variables and their values should be used. The options displayed are from the character connected to the Populate node.

Mesh Variable

../../_images/node-mesh-variable.png

Configure your armature and meshes. The options displayed are from the character connected to the Populate node.

Add behavior to your agents

To add behavior to your agents you first have to create a Crowd Sim Node Tree. In the Node Editor enable Crowd Sim and press New

Note

CrowdSim3D uses behavior trees for adding logic to the agents. See https://en.wikipedia.org/wiki/Behavior_tree_(artificial_intelligence,_robotics_and_control) for more information and https://www.youtube.com/watch?v=YCMvUCxzWz8 for an overview of behavior trees.

The Crowd Sim Node Editor contains various nodes to build up your behavior tree.

Object

Behavior

../../_images/node-behavior.png

This node is the most important node, it executes the behavior tree. This is the root node and should be part of your behavior tree.

Object Selector

../../_images/node-object-selector.png

With this node you can filter on a group of agents:

  • By agent: When checked only agents will be selected. When not checked also other objects can be selected.
  • By name: Filter obects by name. A wildcard * can be added to select multiple objects. For example Agent_*.
  • By factory: Filter only agents that originated from a specific factory.

This node can be attached to various nodes like the Populate node.

Sight Object Filter

../../_images/node-sight-object-filter.png

This node can be used to filter a set of objects based on the distance with the active agent.

Options:

  • Near distance: All objects closer then the Near distance will be removed from the selection.
  • Far distance: All objects further then the Far distance will be removed from the selection.

Composites

Composites define a subtree and the base rule of how this subtree should be executed.

Sequence

../../_images/node-sequence.png

Nodes in the subtree are executed in order, first child-1, then child-2 and so on. Execution of the subtree stops when a child node fails or when all children nodes succeed.

In case of failure the Sequence node returns a Failure state. In case of all children succeeding the Sequence returns a Success or Running state.

The randomize option makes it possible to pick children in the subtree in random order.

Options:

  • Randomize: test output sockets in a random order.

Selector

../../_images/node-selector.png

Nodes in the subtree are executed in order, first child-1, then child-2 and so on. Execution of the subtree stops when a child succeeds or when all children fail.

In case of failure the Selector node returns a Failure state. In case a child succeeds the Selector returns a Success or Running state.

The randomize option makes it possible to pick children in the subtree in random order.

Options:

  • Randomize: test output sockets in a random order.

Parallel

../../_images/node-parallel.png

Nodes in the subtree are executed in parallel. Execution of the subtree stops when a child node fails or when all children nodes succeed.

In case of failure the Parallel node returns a Failure state. In case all children succeed the Parallel returns a Success state.

Decorators

Decorators can modify the result of a node. These decorators can be added as a node or as a modifier in the output of a node. These modifiers are:

Inverter

../../_images/node-inverter.png

Inverts the result. Success becomes Failure and Failure becomes Success. Error and Running remain unchanged.

Inverter
In Out
Running Running
Success Fail
Fail Success
Error Error

Always Succeed

../../_images/node-always-succeed.png

A node always succeed.

Always Succeed
In Out
Running Success
Success Success
Fail Success
Error Success

Always Fail

../../_images/node-always-fail.png

A node always fails.

Always Fail
In Out
Running Fail
Success Fail
Fail Fail
Error Fail

Until Success

../../_images/node-until-success.png

Node keeps running until a Success or an Error is returned.

Until Fail

../../_images/node-until-fail.png

Node keeps running until a Fail or an Error. In case of a failure a Success is returned.

Conditional

../../_images/node-conditional.png

Perform if … else … logic.

If the subtree of a conditional returns Success then the success subtree is executed.

If the subtree of a conditional returns Fail then the failure subtree is executed.

Limiter

../../_images/node-limiter.png

With this decorator you can limit the number of times the subtree is evaluated.

Options:

  • Limit: Max number of times the subtree may be evaluated. Returns Fail when limit is met. Otherwise the result of the child subtree is returned.

Guard

../../_images/node-guard.png

With the Guard decorator you can limit the number of times a subtree is evaluated in the current frame.

Options:

  • Limit: Max number of times the subtree may be evaluated in a frame. Returns Fail when limit is met. Otherwise the result of the child subtree is returned.

Max Time

../../_images/node-max-time.png

With this decorator you can set the maximum time in frames for the child node to be evaluated.

Options:

  • Frames: Max number of frames a node may run before finishing. Returns Fail when limit is met. Otherwise the result of the child subtree is returned.

Repeat

../../_images/node-repeat.png

Set the number of times a child node should be repeated (like a for loop).

Options:

  • times: Number of times the subtree must be executed. Loop is halted when an error occurs.

States

In the side panel of the CrowdSim node tree you can define State Properties. These state properties can be used to store state of an agent.

../../_images/crowdsim-state-properties-panel.png

By pressing Add State Property you can add a new state property to the list. By pressing Remove State Property you can remove the highlighted state property. You can change the name of a state property by double clicking on its name.

A state property has a type. There are 4 types available:

  • String
  • Boolean
  • Float
  • Integer

You can also set a default value for the state properties you define.

State Operation

../../_images/node-state.png

With this node you can perform an operation - Add, Set, Subtract, Multiply - on your State property.

Options:

  • State Property: State property to perform the operation on
  • Operation: Type of operation to perform
    • Set: Update the property to the given value
    • Add: Add the given value to the property
    • Subtract: Subtract the given value from the property
    • Multiply: Multiply the property with the given value
  • Value: The given value for the operation. When using Boolean values you should use 0 for false and 1 for true
Supported state operations
Type Supported Operations
String Set, Add, Multiply
Integer Set, Add, Subtract, Multiply
Float Set, Add, Subtract, Multiply
Boolean Set

When using Multiply together with string based state properties the value needs to be an integer. It does a python string multiplication:

"Hello" * 3 = "HelloHelloHello"

Check State

../../_images/node-check-state.png

With this node you can check your State property against another value.

Options:

  • State Property: State property to perform the operation on
  • Check: Type of check to perform
    • Equal: Is the property equal to the given value
    • Less than: Is the property less than the given value
    • Greater than: Is the property greater than the given value
  • Value: The given value for the operation. When using Boolean values you should use 0 for false and 1 for true
Supported state checks
Type Supported Check
String Equal, Less than, Greater than
Integer Equal, Less than, Greater than
Float Equal, Less than, Greater than
Boolean Equal, Less than, Greater than

Check Attribute

With this node you can check an internal variable of the agent. You can use this node together with the Conditional node to add specific behavior based on the attribute.

../../_images/node-check-attribute.png
  • Attribute: The attribute to check.
    • Collision Impact: The impact that has been calculated during the last intersection test.
    • Agent Speed: Check the current speed of the agent.
    • Agent Model: Check the model (and armature) of the agent.
    • Agent Factory: Check the factory of the agent.
  • Check: The check to perform. Only valid when Attribute is Collision Impact or Agent Speed. Options are
    • Equals: is the attribute equal to the value
    • Less than: is the attribute less than the value
    • Greater than: is the attribute greater than the value
  • Value: The value to perform the check against. Only valid when Attribute is Collision Impact or Agent Speed.
  • Model: The model to check against. Only valid when Attribute is Agent Model.
  • Character: The character to check against. Only valid when Attribute is Agent Model and Model is an armature. This field is optional. When not used only the model will be checked.
  • Factory: The factory to check against. Only valid when Attribute is set to Agent Factory.

Set Attribute

With this node you can set or update an internal variable.

../../_images/node-set-attribute.png

Options:

  • Variable: Variable to update
    • Speed Vector: Allows the updating of direction and speed of the agent.
  • Direction: The direction to set. Only valid when Variable is Speed Vector.
  • Velocity: The velocity to set. Only valid when Variable is Speed Vector.

Actions

With Actions you can define certain actions for your agent.

Note

Tips

  • When your agents are not moving it can be because most of the action nodes only update an internal desired speed vector.

    This vector describes the direction and velocity that the agent wants/can move. Use the Advance Ground Movement node to convert the desired speed vector to actual movement.

Action

The Action node can be used for simple translation and rotation movement. This node applies the movement directly.

../../_images/node-action.png

Options:

  • Duration: the duration that the action takes (in frames).
  • Translation: the translation that happens during the Duration. The translation is applied in the local coordinate system of the object.
  • Rotation: the rotation that happens during the Duration. The rotation is applied in the local coordinate system of the object.

Average Speed Vector

Updates the desired speed vector of the agent to the average of a group of agents.

../../_images/node-average-speed-vector.png

Sockets:

  • Agents: The selection of agents to calculate the average speed vector from. When socket is not linked, all agents in the scene will be used as selection.

Options:

  • Skip Yourself: When you are in the selection of agents, ignore yourself.

Play Action

With this node you can add animations to your agent.

Play Actions Type

../../_images/node-play-action.png

With this option you can add your own actions. The crowd simulation plays the animation. You can set the number of frames in the Blend In - Blend Out option.

With Add Action you can add a new action slot. Multiple actions can be played back at the same time.

Options:

  • Priority: When merging actions what priority should be considered. Higher number means higher priority and the animation will not be interfered with actions that plays with less priority.
  • Duration: The duration to play the action.
  • Blend In: Number of frames to blend in the animation
  • Blend Out: Number of frames to blend out the animation.

Walk Type

../../_images/node-play-action-walk.png

With this option you can generate a walk cycle based on the actual velocity and angular velocity of the agent.

This node uses the velocity and angular velocity of an animation action. The data can be modified in the Dope Sheet.

../../_images/action-crowdsim-panel.png

In the Dope Sheet ‣ Action Editor ‣ CrowdSim you can set the velocity and the angular velocity of the action.

The Play Action node selects up to 3 closest animation actions based on the actual velocity and angular velocity of the agent. With this It merges these actions to create a better suited animation for the actual velocity and angular velocity of the agent.

Options:

  • Blend Type: How to blend in the animation. Possible options are:
    • Linear: Use linear blending
    • Curve: Use curve blending
  • Blend In: Number of frames to blend in the animation
  • Blend Out: Number of frames to blend out the animation.

Advance Ground Movement

With this node the current desired speed vector is used to advance the position of the agent for this frame.

../../_images/node-advance-ground-movement.png

Options:

  • Angular Velocity: Maximum angular velocity in degrees per second.
  • Stick on Edge: When a navigation mesh is used make sure that the agent will always be placed at the nearest location on the navigation mesh.

Avoid

With this node you can set the Algorithm for Avoiding other agents and obstacles. The Avoid node uses the desired speed vector and the surrounding area of the scene to avoid obstacles like walls and other agents.

At the end of this action the desired speed vector is updated.

Simple

../../_images/node-avoid.png

Uses a very basic algorithm to avoid agents only. Obstacles are not supported.

Options:

  • Viewing Angle: Set the Angle to consider. The algorithm will use this angle to look for agents to avoid.
  • Viewing distance: Set the distance to be considered. The algorithm will use this distance to determine how far to look for agents to avoid.
  • Number of Segments: This option relates to the viewing Angle. The viewing Angle will be divided in a number of segments. The algorithm will evaluate each segment to look for agents to avoid. The segment with the least number of agents will be taken.
  • Agent Distance: This option determines the minimal distance between agents to take into account.
  • Look Ahead: With this option you can determine how far ahead - in terms of time and samples - the algorithm should look.
  • Advanced Options: With this option you can set the Deceleration factor.

RVO2

../../_images/node-avoid-rvo2.png

Uses the RVO2 algorithm to avoid agents and obstacles. The navigation mesh used in the Navigate node will be converted into obstacles. For every area where an agent cannot walk on the navigation mesh an obstacle wall will be added to the evaluation.

Options:

  • Maximum Neighbors: Sets the maximum of neighbors to be considered.
  • Agent Distance: Sets the distance between agents to be considered.
  • Viewing Distance: Sets the viewing distance to be considered.
  • Time Horizon: Sets the Time Horizon for agents to be considered.
  • Time Horizon Obstacles: Sets the Time Horizon for obstacles to be considered.

Force Based

../../_images/node-avoid-force-based.png

Uses a basic force based algorithm to avoid agents and obstacles. The navigation mesh used in the Navigate node will be converted into obstacles. For every area where an agent cannot walk on the navigation mesh an obstacle wall will be added to the evaluation.

Options:

  • Subframes: Sets the number of subframes to calculate.
  • Scaling: Sets an overall scaling factor for the forces.

Force Based (TTC)

../../_images/node-avoid-force-based-ttc.png

Uses a time to collision force based algorithm to avoid agents and obstacles. The navigation mesh used in the Navigate node will be converted into obstacles. For every area where an agent cannot walk on the navigation mesh an obstacle wall will be added to the evaluation.

Options:

  • Subframes: Sets the number of subframes to calculate.
  • Scaling: Sets an overall scaling factor for the forces.

Targets

In the side panel of the CrowdSim node tree you can define Target Properties. These target properties can be used in the Behavior tree to let an agent lock to another agent or object.

../../_images/crowdsim-target-properties-panel.png

By pressing Add Target Property you can add a new target property to the list. By pressing Remove Target Property you can remove the highlighted target property. Double clicking on the target property you can change its name.

Several nodes uses the target properties:

Lock to Target

Lock to a target.

../../_images/node-lock-target.png

Socket:

  • Agents: The selection of agents to choose from. When socket is not linked, all agents in the scene will be used as selection.

Options:

  • Target Property: Target property to store the locked target in. If a target property is already filled for the active agent, then this node will be ignored. You first need to use the Unlock Target node to unset the target property.
  • Randomize: Randomize the agent selection before choosing one.
  • Maximum: Maximum that the target can be selected for the chosen target property.

Unlock Target

Unset the target property from the active agent.

../../_images/node-unlock-target.png

Options:

  • Target Property: Target property to unset.

Has Locked Target

Test if the active target has a target selected for the chosen target property.

../../_images/node-locked-target.png

Options:

  • Target property: Target property to check.

Is Agent Targeted

Test if an agent is locked by another target. It tests the reverse of ‘Has Locked Target’.

../../_images/node-agent-targeted.png

Options:

  • Target property: Target property to check.

Collisions

Intersection

../../_images/node-intersection.png

With this node you find if the active agent intersects another mesh or agent. You can configure how precise the detection has to be calculated. You can choose between:

  • Bounding box: Uses axis aligned bounding box (AABB) checking
  • Convex hull: Checks intersection by using the convex hulls of the objects.
  • Triangle Mesh: Checks intersection by using the triangular meshes of the objects.

When an intersection is detected the intersection impact internal variable is updated with the detected force.

Run the crowd simulation

In your Node Tree Press Execute Behavior on the Behavior node, and play your crowd sim animation.