MeshPinGoto

A MeshPinGoto Behavior (beMeshPinGoto) is a simple behavior to orient mesh-pinned Entities movement direction towards a target. Note that no avoidance is involved in this process, and entities may intersect with each other. Only one MeshPinGoto can be active for an entity at once, else the behavior is undefined.

A MeshPinGoTo behavior in the behavior editor

This behavior needs to run in parallel with a MeshPin Behavior or it won't have any effect. See how to properly handle dual Behaviors here.

CREATION

  • Behavior Editor / Behavior Library: 
  • Golaem Menu: Crowd Behaviors / Behaviors / CrowdBeMeshPinGoto Node
  • MEL command: glmCrowdBeMeshPinGotoCmd;

CONFIGURATION

A MeshPinGoTo Behavior defines the following specific attributes. For common attributes see Behavior Common Attributes.

Target Attributes

Reach Mode

Two Reach Modes are available:

  • Reach: the Crowd Entities will reach their target based on the Target Mode.
  • Flee: the Crowd Entities will flee in the opposite direction of their target based on the Target Mode
Target Mode
This mode is similar to Goto Behavior, except that there is no "random target in environment" mode. It is possible to define a target to reach for each entity. The Target Mode attribute determines how targets are assigned:

Use Target Poptool

If this mode is selected, 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:

Target Particle System

If this mode is selected, each Entity will be assigned to its corresponding particle in the target particle 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.
 
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 Attribute

If this mode is selected, each Entity will be assigned to the position stored in the vector per-particle attribute stored in the "Target PPName" attribute. The Y value of this per-particle attribute will be projected on the terrain. See ppAttributes Handling.

Target Expression

If this mode is selected, each entity will have a target given by the expression in the In Target Expression attribute.

Golaem Attribute

Use a Golaem Attribute of type Vector as target

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

  • By Id: the population tool slots are assigned according to the entity id
  • Random: the population tool slots are assigned randomly. A random slot of the poptool will be chosen as target each time the behavior is restarted or if "Target is Dynamic" is checked.
  • MEL Command: the user can control how the slots are assigned through a MEL function specified by the "Slot Assign MEL" attribute. The MEL function uses the index of the entity. Here's a template for this function (equivalent to the "By Id" mode):
global proc int defaultSlotAssign(int $index)
{
    return $index;
}
Slot Assign MEL See "Slot Assign Mode" above

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.

Target is Dynamic 

The Target Is Dynamic checkbox must be checked for a moving target. When enabling this option, 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. 

In Vector Field Locator Paintable Vector Field locator which will influence the way the Entities will reach their target.