Master-Slave

A Master-Slave Behavior (beMasterSlave) binds a slave entity position and/or orientation to a master entity bone, with optional offsets. It must be placed on Slave EntityType, and reference its master. The master-slave binding is done on a one-to-one basis, for each entity of those types.
 
A beMasterSlave Behavior in the Behavior Editor
 
Note that this behavior depends on EntityType / Advanced Attributes / Master-Slave Level. In order to bind a slave entity to a master, one must ensure that the master is updated first. See EntityType
 
Note that Master-Slave relations can only be achieved into the same CrowdField.

Creation

  • Behavior Editor / Behavior Library: 
  • Golaem Menu: Crowd Behaviors / Behaviors / CrowdBeMasterSlave Node
  • MEL command: glmCrowdBeMasterSlaveCmd;

Configuration

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

Master / Slave Attributes

Offset Mode

Static Offset : The entity will be slaved to a given entityType / bone name with an optional offset in bone local position / orientation. Matching is made per entity of same index (with modulo) : first entity of this type will be slaved to first entity of the configured type.

Freeze On Collided : The entity will find the first entity/bone matching the configured criterions, and keep the same offset as when the behavior starts. This is useful to stick arrows in bucklers for example. In this mode, it is advised to put a start trigger detecting the collision first (or the behavior may just fail).

Closest Entity : The entity will find the closest entity/bone matching the configured criterions, and keep the same offset as when the behavior starts. This is useful to put passengers in a car for example. Note that closest entity is searched first, from the root position. Thus, it may occur that another entity have a bone closer to the target, but the root further. In that case, the closest root is selected first, and the closest bone of this entity in a second time.

Static Offset Attributes

In Master EntityType

Specify which EntityType will be used as master EntityType

Master Bone Name

The given name must be a valid bone name of the selected EntiyType (click helper to pick one)

Orientation Mode

Specify how the slave entity orientation must be constrained to the master bone orientation.

 Aim At XYZ

If the Orientation Mode is set to Aim At, specifies if the slave entity orientation must be aiming at the master bone position for the XYZ components.

Orientation Offset

Adds an offset to the master bone orientation, in master bone referential, before applying it to the slave.

Constraint Position XYZ

Specify if the slave entity position must be constrained to the master bone position in the XYZ components.

Position Offset

When non null, this offset will be applied in Master bone referential, in addition to the Master bone position, before applying it to the slave.

Scale Position Offset

When using position offset, it may be suitable, or not, to scale it according to master scale.

Freeze Attributes

Those attributes are only available when the Offset Mode is set to Freeze On Collided. In this mode, it is expected that a start trigger detects a collision before starting this behavior, or it may just fail if there is no collision at start time (the behavior will not wait for collision, but will exit or fail if no collision is found at first call). The entity will keep its relative position and orientation, to the hit bone/entity, until the behavior stops.

In Master EntityTypes

The list of the types that this entity may stick on

Collider Bone Names

The list of all bones of the types, this entity may stick on.

Closest Entity Attributes

Those attributes are only available when the Offset Mode is set to Closest Entity. In this mode, the closest entity of given types is found at behavior start (if any). On this entity, the closest bone is tested against all the bone name list. The entity will keep its relative position and orientation, to the closest entity/bone found, until the behavior stops.

In Closest EntityTypes

The list of the types that this entity may stick on

Closest Bone Names

The list of all bones of the types, this entity may stick on.