Go To
A Go To Behavior (beGoto) finds a path to reach a target for an Entity.
To use a Go To Behavior, the Terrain Locator associated to the Crowd Manager must use a NavMesh.
This behavior needs to run in parallel with a Navigation Behavior to allow Entities to avoid obstacles and other entities. See how to properly handle dual Behaviors here.
Unlike the other behaviors, by default the Go To Behavior automatically stops when an Entity reaches its target. If its Stop Trigger triggers before, it will stop according to this trigger. To change this behavior, disable Stop On Target Reached in the Advanced Attributes (see below)
CREATION
- Behavior Editor / Behavior Library:
- Golaem Menu: Crowd Behaviors / Behaviors / CrowdBeGoto Node
- MEL command: glmCrowdBeGotoCmd;
CONFIGURATION
Target Attributes
Reach Mode |
Two Reach Modes are available:
|
Target Mode |
It is possible to define a target to reach for each entity. The Target Mode attribute determines how targets are assigned:
Target modes of a Go To Behavior A target is considered valid if its projected position on the Terrain is inside the environment and not in an obstacle zone. A target is accessible if there is a valid path from the entity's initial position to the target projected position on the navigation mesh. Figure below illustrates those differences:
Valid/Invalid, accessible/inaccessible targets The Go To behavior will try to place the target inside the navigation mesh if it's invalid. Random Target in EnvironmentIn this mode, each Entity will be assigned to a random valid & accessible target on the NavMesh. The targets can neither be viewed nor edited. This attribute is influenced by the random seed of the Crowd Manager.
Random target mode Use Target PoptoolIn this mode, all entities will try to reach slots on the Crowd Target Locator selected in the "In Target Poptool" field. Here are the results of this mode:
Use Target Poptool Target Particle SystemIn this mode, each Entity will be assigned to its corresponding particle in the target particle (or nParticle) system selected in the "In Particle System" field (i.e. entity of particleId 1 will be assigned to the target of particleId 1…). If the target particle system contains fewer particles than the navigating Entity, the entity particleId will be moduled by the size of the target particle system (i.e. entity of particle 6 will be assigned to the target of particleId 1 if the target particle system has 5 particles...).
Note that Golaem Crowd Population Tool can be used to emit the target particle system.
Example of a target particle system It is also possible to specify the assignment of each Entity in the targeted particle system thanks to the field "Target Id PPName". If this field is set, each Entity will be assigned to the target whose id is stored in the float per-particle attribute stored in the "Target Id PPName" attribute of its relative particle. If this field is not set, or its value for one Entity is negative, the particleId will be used. See ppAttributes Handling.
Per Particle Target AttributeIn this mode, each Entity will be assigned to the position stored in the vector Golaem Attribute (or per-particle attribute) stored in the "Target PPName" attribute. The Y value of this per-particle attribute will be projected on the terrain. See Golaem Attributes Handling (or ppAttributes Handling).
Example of the per-particle attribute targets Target ExpressionIn this mode, each entity will have a target given by the Expression or Channel to evaluate the In Target Expression attribute. Follow CurveIn this mode, each entity fill follow a curve among the ones that are mapped to the GoTo Behavior.
Target MeshIn this mode, each entity will target a component (vertex, face or edge) of the mesh that is mapped to the Go To Behavior. Follow TrackIn this mode, each entity will follow a Track Locator which defines a path using one or two Maya curves. |
Target Reach Threshold | When the distance to the target is smaller than this threshold, the target is considered reached and the Go To Behavior stops. |
Target Flee Threshold | If the Reach Mode is set to "Flee", the target is considered reached and the Go To Behavior stops when the distance to the target is higher than this threshold. |
Target is Dynamic |
The Target Is Dynamic checkbox must be checked for a moving target. If this option is enabled, the Target Update Period becomes available. When using dynamic targets, the path of the Entity to the target will be recomputed during the simulation. When using dynamic targets, it is possible to make two particle systems target each other (i.e. for battle scenes). |
Target Update Period | This parameter defines the number of frames before recomputing the path to the target (which means that during this time, the target's position won't change). Keep in mind that computing the path to the target is a heavy operation that can decrease the performance of the crowd simulation, especially if the target update period is low. |
Target PopTool Attributes
In Target Poptool | See "Use Target Poptool" mode above. |
Slot Assign Mode |
Available in "Use Target Poptool" mode. This determines the way the population tool slots are assigned as goto targets
global proc int defaultSlotAssign(int $index) { return $index; } |
Slot Assign MEL | See "Slot Assign Mode" above |
Target Curve Attributes
Follow Curves | The curves to follow. |
Reverse | if checked, the curve following will go from the end to the start of the curve |
Curve Assign Mode |
If several curves are mapped to the GoTo behavior, this attribute determines the way an entity chooses a curve:
|
Curve Start Mode |
This attribute determines the point on the curve from which the entity will start following the curve
|
Curve Sampling Mode |
This attribute determines how the curve is sampled. The GoTo behavior picks up a number of points on the curve that are used as waypoints to reach.
|
Curve Sample Count | The number of points to use on a curve in Uniform curve sampling mode. |
Spread Along Curve | When enabled, this computes the lateral offset to the path to follow autiomatically, according to the inital distance to the curve. The spread can be set using the Spread Ratio attribute |
Spread Ratio | Lateral offset ratio according to the initial distance to the curve |
Target Mesh Attributes
In Target Mesh | The target mesh in Target Mesh mode |
Mesh Component Mode |
The type of mesh component to target:
|
Mesh Assign Mode |
This defines the way mesh components are assigned as targets:
global proc int defaultSlotAssign(int $index) { return $index; }
|
Keep Initial Slots |
If enabled, assigned slots will only be computed once, even if the target is dynamic. |
Relative Position |
The position to use relative to the entity when the Mesh Assign Mode is set to Relative Closest. The Relative Position is added to the Target mesh, and then the closest slot is computed. |
Slot Assign MEL |
See "Mesh Assign Mode" above. |
Target Track Attributes
Follow Tracks | The Tracks to follow. Only the first mapped Track Locator is taken into account. |
Reverse | Reverse the direction of the Track. |
Other Target Modes Attributes
In Particle System | See "Target Particle System" mode above. |
Target Id PPName | See "Target Particle System" mode above. |
Target PPName | See "Per Particle Target Attribute" mode above. |
In Target Expression | See "Target Expression" mode above. |
General Target Attributes
In Vector Field Locator | Paintable Vector Field locator which will influence the way the Entities will reach their target. |
Path Following Attributes
Path Follower Update Period | The number of frames before updating the path local target. Lower values can decrease performance and are only needed in tight environments. |
Path Lateral Offset |
When following a path to the target, this parameter determines the offset of the entity to the path. A negative value means the entity will try to follow its path while keeping to the left of it by the amount of this parameter, a positive value means the entity will follow the path to the right, and 0 means the entity will stay on the path. The lateral offset is taken into account only if the Spread Ratio is greater than 0. The offset can be set either randomly, between Path Lateral Offset Min and Path Lateral Offset Max, or according to a per particle attribute. It can also be computed automatically in Follow Curve mode. |
Spread Ratio | The factor to which to take lateral offset into account. If left to 0, no lateral offset is applied. |
Advanced Attributes
Allow Collision At Start | Enable this to allow computing a path that starts in a non-navigable cell. It will help only if it can directly reach a navigable one. May help obtaining successful path plannings near the navigable area borders, when the Perception Shape of the entity overlaps an obstacle. |
Stop On Target Reached | When enabled (on by default), the Go To behavior will stop when the target is reached. When disabled it allows to follow a dynamic target, even after it has been reached. |