Locomotion

A Locomotion Behavior (BeLocomotion) uses a set of Motion Clips and dynamically blends them together to follow the current position and velocity of the particle (which can be driven by a Maya Field, a Navigation Behavior...). Contrary to the Motion behavior, with this behavior the character is no more snapped on its particle but is more driven by it. This results in better turns and resulting animation. See the algorithm part for a more detailed explanation on how this behavior works.
A Locomotion Behavior in the Behavior Editor

Creation

  • Behavior Editor / Behavior Library: 
  • Golaem Menu: Crowd Behaviors / Behaviors / CrowdBe Locomotion Node
  • MEL command: glmCrowdBeLocomotionCmd;

Best practices

As the Locomotion Behavior may blend any pair of Motion Clip in its set, it is recommended to only use Motion Clips with the same style. For instance, if there is one motion with arms up and another with arms down, the character will constantly move arms up and down as a side effect of the locomotion, which is usually not expected.

In such a case, two different Locomotion Behavior (one for arms up, the other one for arms down) should be created, and the switch between the two made when desired by using a trigger.

Best practices for the creation of the motion set are described here.

Configuration

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

Motion Attributes


 
Motion Files (.gmo file)

Motions Clips to use in the Locomotion System.

You can specify a replay speed ratio for each Motion Clip. It is recommended to use replay ratio near 1 (between 0.3 and 1.2 seems reasonable values: slowing down motions is more likely to be perceived as real than speeding them up).

Each animation can use a different Motion Mapping by setting the Mapping index in the Mapping column. Mapping index refers to the number written in the Motion Mapping File[n] label (see below).

Use the "Add New Motion Clip" button and the trash icon to add or remove motions.
Use the ">" button to select the related Motion Clip node and access to its attributes.
Use the  icon to mirror the relative animation ( to load the original animation, to load the mirrored animations,  to load both original and mirrored animation). It is recommended when you don't have both the turn-left and turn-right motions. In this case, use the mode to load both original and mirrored motion at the same time.
For mirror animation to work properly, the mirror must be correctly configured on the skeleton mapping, as explained on this page.
Use the  icon to enable / disable a Motion Clip without removing it from the behavior.

You can add Motion Clips (and their related motion files) directly by double-clicking on the behavior in the Behavior Editor and by selecting one or several motion files in the dialog.

Notice that the provided Motion Clips need to define a root translation and/or delta orientation (used to compute the original velocity of the motion). See the Motion Tab of the Character Maker or the Motion Clip attributes to see how to ensure Motions are correct and edit them.
Compute Mirror Check each Motion File loaded and if it corresponds to a turn, enable Motion mirroring on it

Motion Mapping Attributes


 
Motion Mapping Mode / Motion Mapping File

This attribute allows a choice of four motion mapping modes :

  • Automatic: In this mode, Golaem Crowd will try to build a Motion Mapping automatically. This will work in most cases but you may have to build a Motion Mapping File if the motion is not replayed as desired (see here)
  • Identity: In this mode, each channel will replay the same channel index. Use this mode when playing an animation built from the same skeleton as the entity's skeleton
  • Motion Mapping File (default mode): In this mode, a valid Motion Mapping File (.gmm) should be provided. To learn how to create your Motion Mapping File, see here. Use the "Add New Mapping File" button and the trash icon to add or remove Motion Mapping Files. One Motion Mapping File can be used by multiple motions (see Locomotion Files above)
  • EntityType Motion Mapping File: In this mode, a valid Motion Mapping File (.gmm) should be provided in the corresponding EntityType Node. To learn how to create your Motion Mapping File, see here

Starting / Stopping Duration Attributes

The Starting / Stopping Duration value determines the time (in seconds) during which the animation goes from inactive to fully active (or vice versa). This time can be used to transition smoothly between two behaviors. When transiting from one Motion/Locomotion behavior to another, it is the average time between the Stopping Duration of the stopping behavior and the Starting Duration of the starting behavior which is used as transition time.

Starting / Stopping Duration Mode

This attribute allows a choice of two modes :

  • Random: Randomly set the Starting / Stopping Duration value between the specified "Starting / Stopping Duration Min" and "Starting / Stopping Duration Max" bounds (this attribute is influenced by the random seed of the Crowd Manager)
  • Per-Particle Attribute: Use the "Starting / Stopping Duration Name" attribute to get the name of the float per-particle field of the relative particle system, containing the Start Percent value.

The Starting / Stopping Duration value is in seconds.

Starting / Stopping Duration Min See Random option of the Starting / Stopping Duration Mode above
Available only when the Starting / Stopping Duration Mode is set to "Random"
Starting / Stopping Duration Max See Random option of the Starting / Stopping Duration Mode above
Available only when the Starting / Stopping Duration Mode is set to "Random"
Starting / Stopping Durationpp Name Name of the float per-particle field of the relative particle system, containing the Starting / Stopping Duration Mode value which will be used (for more explanation about how to use ppAttributes, see ppAttributes Handling)
Starting / Stopping Duration value is set to 0 if the ppAttribute name is empty or invalid
Available only when the Starting / Stopping Duration Mode is set to "Per-Particle Attribute"
When fine-tuning the transition between two consecutive Motion or Locomotion behaviors, it's advised to use the Animation Transitions, which will automatically fill the starting/stopping durations of the behavior.

Body Mask Attributes

By default, a motion is played on the entire body (as specified in the Motion Mapping File). But the Motion Mapping File configuration can be filtered by the body mask to replay the animation only on specified channels.



Body Mask Attributes of a Motion Behavior

Pelvis If this box is checked, the pelvis part of the motion will be played. The pelvis part includes the global position and orientation of the animation. If not checked, the animation will be played "in place" 
Spines List of the spines nodes to play on the entity. Use the  button to open a window with the name of all the available spines for the Character Files loaded in the scene. Those names can also be found in the Motion Mapping Panel of the Character Maker.
Star ( * ) wildcard is authorized at the beginning or/and end of names (i.e. spine*, *spine, etc.).
Separate the channel names by comma ( , ), leading and trailing spaces will be ignored.
Use the * wild card to use all limbs.
Names are NOT case sensitive (compared as lowercase).
Limb Channels

List of the limbs channels to play on the entity. Use the  button to open a window with the name of all the available Limbs for the Character Files loaded in the scene. Those names can also be found in the Motion Mapping Panel of the Character Maker.
Star ( * ) wildcard is authorized at the beginning or/and end of names (i.e. left*, *arm, etc.).
Separate the channel names by comma ( , ), leading and trailing spaces will be ignored.
Use the * wild card to use all limbs.
Names are NOT case sensitive (compared as lowercase).

Effector Channels List of the effectors ​channels to play on the entity. Use the  button to open a window with the name of all the available Effectors for the Character Files loaded in the scene. Those names can also be found in the Motion Mapping Panel of the Character Maker.
Star ( * ) wildcard is authorized at the beginning or/and end of names (i.e. left*, *arm, etc.).
Separate the channel names by comma ( , ), leading and trailing spaces will be ignored.
Use the * wild card to use all effectors.
If an effector channel is selected, the corresponding limb channel is automatically added also.
Names are NOT case sensitive (compared as lowercase).
Blind Data Groups

List of Blind Data Nodes or Blend Shape Groups to play on the character. Use the  button to open a window with the name of all the available Blind Data Nodes and Blend Shape Groups for the Character Files loaded in the scene. Those names can also be found in the Skeleton Mapping panel of the Character Maker
Star ( * ) wildcard is authorized at the beginning or/and end of names (i.e. mouth*, *eye, etc.).
Separate the Group names by comma ( , ), leading and trailing spaces will be ignored.
Use the * wild card to use all Groups.
Names are NOT case sensitive (compared as lowercase).

Blind Data List of Blind Data or Blend Shape to play on the character. Use the  button to open a window with the name of all the available Blind Data and Blend Shape for the Character Files loaded in the scene. Those names can also be found in the Skeleton Mapping panel of the Character Maker.

Star ( * ) wildcard is authorized at the beginning or/and end of names (i.e. mouth*, *eye, etc.).
Separate the Blind Data / Blend Shape names by comma ( , ), leading and trailing spaces will be ignored.
Use the * wild card to use all Blind Data / Blend Shape.
Names are NOT case sensitive (compared as lowercase).

Start Percent Attributes

The Start Percent value determines the percentage of the first motion at which the Locomotion is started. For instance, use value 0 to start at the beginning of the motion, or use value 0.5 to start at the middle of the motion ...

Start Percent Mode This attribute allows a choice of two Start Percent modes :

Start Percent mode of a Locomotion Behavior
  • Random: Randomly set the Start Percent value between the specified "Speed Ratio Random Min" and "Speed Ratio Random Max" bounds (this attribute is influenced by the random seed of the Crowd Manager)
  • Per-Particle Attribute: Use the "Start Percentpp Name" attribute to get the name of the float per-particle field of the relative particle system, containing the Start Percent value
Start Percent  Random Min See Random option of the Start Percent Mode above
Available only when the Start Percent Mode is set to "Random"
Start Percent  Random Max See Random option of the Start Percent Mode above
Available only when the Start Percent Mode is set to "Random"
Start Percentpp Name

Name of the float per-particle field of the relative particle system, containing the Start Percent value which will be used on the Motion (for more explanation about how to use ppAttributes, see ppAttributes Handling)
Start Percent value is set to 0 if the ppAttribute name is empty or invalid
Available only when the Start Percent Mode is set to "Per-Particle Attribute"

Priority/Weight Attributes

If several Motion or Locomotion behaviors are played at the same time on the same part of the body, only the behaviors with the highest priority will be played. If several behaviors share the same priority, they will be blended together according to their weight normalized value (for instance, if two Motion behaviors share the same priority with a weight value of 1, they will be blended each at 50%). 

See the Body Mask attribute to know how to apply a behavior on specific parts of the body

Priority/Weight Attributes of a Locomotion Behavior
Priority

Priority to affect to Locomotion Behavior

Weight Mode This attribute allows a choice of two Weight modes :

Weight mode of a Locomotion Behavior
 
  • Random: Randomly set the Weight value between the specified "Weight Random Min" and "Weight Random Max" bounds (this attribute is influenced by the random seed of the Crowd Manager)
  • Per-Particle Attribute: Use the "Weightpp Name" attribute to get the name of the float per-particle field of the relative particle system, containing the Weight value
Weight  Random Min See Random option of the Weight Mode above
Available only when the Weight Mode is set to "Random"
Weight  Random Max See Random option of the Weight Mode above
Available only when the Weight Mode is set to "Random"
Weightpp Name Name of the float per-particle field of the relative particle system, containing the Weight value which will be used on the Motion (for more explanation about how to use ppAttributes, see ppAttributes Handling)
Weight value is set to 0.5 if the ppAttribute name is empty or invalid
Available only when the Weight Mode is set to "Per-Particle Attribute"

Locomotion Attributes

 
Control Mode

Locomotion Behavior Control Modes
Control Mode of a Locomotion Behavior

  • Follow Mode (default mode): In this mode, the angular and linear velocities are computed as explained in the Follow mode algorithm part, and the entity's position is not locked on the particle's position
  • Direct Mode: In this mode, the angular and linear velocities from the particle are directly used, and the entity's position is locked on the particle's position (as explained in the Direct Mode Algorithm)
  • Direct Mode controlled by animation: this mode works the same way than the follow mode, except that the particle's position is locked on the entity's position, which helps handling collisions between entities in a more accurate way (as explained in the Follow mode driven by animation algorithm)
Reactivity

In Follow Mode, this factor that determine how much an entity will try to correct the position error with its particle instead of following the particle's velocity. If set to 0, the entity will not try to correct its position at all (and will just use the particle's velocity), if set to 1, the entity will compromise between the position error correction and the particle's velocity.

Max Linear Acceleration In Follow Mode, this attribute determines the max change of linear velocity when new velocities are computed. Higher value will allow a better reactivity but with the risk of glitches in the animation (unit: meters/second²)
Max Blending Angular Acceleration In Follow Mode, cap the acceleration that can be produced by the blending to avoid too abrupt changes in chosen animations. In case the Delaunay triangulation, produced by locomotion database, has some very flat triangles, this may help having some fluid blending. Note that the preferred solution would be to have a coherent locomotion animation set that does not produce flat triangles. 
Max  Angular Velocity Correction

In Follow Mode, once the locomotion blending has occurred, the additional angular velocity correction which helps to catch up requested angular speed cannot exceed this value (in degrees, per frame). 

Frames to Mean Angular Velocity In Direct Mode, the angular velocity will be a mean of x last frames. This is used to damp oscillations of input velocity direction.
Target Reached Threshold When the distance between the particle and the entity is smaller than this threshold, the target is considered reached (unit: meters)
Moving Entity Velocity Threshold When the entity's speed is under this threshold, the locomotion considers it's not moving anymore
Min Update Period In Follow Mode, this attribute determines the minimum interval at which new velocities are computed (unit: seconds)
Max Update Period In Follow Mode, this attribute determines the maximum interval at which new velocities are computed (unit: seconds)
Max Delta Position In Follow Mode, this attribute determines the maximum position difference (between the particle and the entity) before new velocities are computed (unit: meters)
Max Delta Velocity In Follow Mode, this attribute determines the maximum velocity difference (between the particle and the entity) before new velocities are computed (unit: meters/second)

First Motion Attributes

Replay Ratio In Follow Mode, this attribute determines the ratio of the first motion to play before using the follow mode (1 means it will be played at 100%, 0.5 means only the first half will be played).
See the first motion part for more explanations.
Starting Duration In Follow Mode, this attribute determines the starting duration of the first motion to play (works as explained in the Motion Attributes, but for the first motion).
See the first motion part for more explanations.
Stopping Duration In Follow Mode, this attribute determines the stopping duration of the first motion to play (works as explained in the Motion Attributes, but for the first motion)
See the first motion part for more explanations.

Starting Velocity Attributes

Starting Linear Velocity The linear velocity that is considered when starting the behavior (taken into account for accelerations)
Starting Angular Velocity The angular velocity that is considered when starting the behavior (taken into account for accelerations)
 
Enable Time Warping

If checked, the motion will be blended with time warping on limbs. Time warping is a technique that allows to locally change the speed ratio of a motion to ensure better synchronization with other motions.
Enabling time warping gives better results in most of the cases, but may produce some glitches in the motion sometimes.

Create Neutral Animation If Needed If checked, an empty animation will be added in the Motion Clips set to ensure there is a motion for null linear and angular velocities.
Check collision with navmesh In Direct Mode controlled by animation, checking this option will prevent the animated skeleton from getting out of the navmesh by projecting it on its last known position on the navmesh.

Advanced Attributes

Interpolate Between Frames

If checked, the motions will interpolate postures between frames of the animation.

This usually gives better results, but if your motions have a framerate superior to the Maya framerate, this option can be unchecked for performances purposes.

IK plane roll from animation This option should be checked when some specific animation produce a bad knee/elbow position on characters
Motions sync mode

This option specify how the animations in the locomotion set are synchronized together:

  • Sync on support cycles (default): animations will be synchronized on the middle of the support phases of each leg of the character (ie: animations will be accelerated/decelerated so that the middle fo each support phases of each animation occurs at the same time)
  • Sync on animation cycles: animations will be synchronized on the first frame of the animation (ie: animations will be accelerated/decelerated so that the first frame of each animation occurs at the same time)
    This option should only be used for animations that have similar support sequences timings (in percent of the animation)

Visual Feedback Attributes

Defines the Locomotion Behavior Visual Feedback displayed in the Crowd Visual Feedback. For common Visual Feedback attributes see Behavior Common Attributes.

Notice that these attributes can also be configured in the Crowd Visual Feedback

Visual Feedback Attributes of a Locomotion Behavior
 
Locomotion Model

Show the locomotion model relative to the set of motions added to the Locomotion Behavior inside the Crowd Visual Feedback.

Locomotion Model in the Crowd Visual Feedback
Some info on the locomotion database are written on the upper left corner (for instance, you can check whether the database is 1d or 2d, or check the triangle count to ensure there are no flat triangles in the database)
There are four dots displayed on the base:
  • the red dot represent the current values of linear and angular velocities that is computed by the locomotion behavior;
  • the yellow/green and blue dots represents the motions that are currently blended rogether, and the size of each dot is related to the Motion Clip current weight in the locomotion model.
A tooltip with the detail of the relative Motion Clip is available upon each intersections.
It's possible to zoom (mouse wheel) and drag (hold left mouse button + move) in the locomotion model view.
Motions

Show motions and their current weight inside the Crowd Visual Feedback according to the Motions mode:

  • None: Nothing is shown.
  • Current: Show only motions currently used, i.e. motions with a non null weight.
  • All: Show all motions of the Locomotion Model.

Depending on the animation set, a one-dimension locomotion database might be detected as a two-dimension one, inducing some wrong blending between the motions at the extremity of the database. If such a thing occurs, the way to fix it is to increase the Delaunay Databse Epsilon parameter located in the extra attributes of the Locomotion Behavior.

Algorithm

For each Motion Clip loaded in this behavior, the linear and angular velocities are extracted (based on the complete translation of the Motion Clip and its duration) and added into a two-dimensional parametric space (one dimension being the linear velocity, the other dimension being the angular velocity), as represented in the following figure:
Abstract representation of the two-dimensional parametric space containing the Motion Clips
 
In this figure, each blue dot represents a different Motion Clip with its linear velocity on ordinate (vertical axis) and its angular velocity on abscissa (horizontal axis). The red dot represents the current value of linear and angular velocities (both linear and angular velocities to zero in this case).

Blending Weights in Direct Mode

In direct mode, the entity's position is locked on the particle's position. The velocity or the particle is used directly to drive the blend weights of the Motion Clips.

Blending Weights in Follow Mode

In follow mode, the entity's position is not locked on the particle's position. The position/velocity error between the entity and the particle is used to drive the blend weights of the Motion Clips.

At runtime, the behavior computes the difference between the particule's position/velocity and the entity's position/velocity and find the best linear/angular velocities to correct this error Finally, the behavior uses the two-dimensional parametric space to find the three nearest motions of this desired linear and angular velocities to blend together

Blending Weights in Direct Mode Controlled by Animation

In direct mode controlled by animation, the particle is locked on the entity, but the navigation do not drive it's position. Instead, it just issue commands on linear and angular velocity that the locomotion is trying to follow, which then drives the position/orientation of the entity.

To check out the command issued by the navigation, and how well the locomotion do respond to it, you can open the Crowd Visual Feedback:


Particle's velocity (right) is the issued command while Entity's velocity (left) is what the locomotion managed to do with it's given set of animations

First Motion

When the particles starts moving, a specific process takes place to ensure the best starting animation as possible:


with first motion

without first motion

Here is how it works:

  • When the particles starts moving, the behavior computes the difference between the new moving direction and the current entity's orientation

  • Then the behavior checks the changes of direction in all the motions in set:
45° left 180° left 180° right
  • And the best motion (in this case: 180° left) is played once before the follow mode starts.

The first motion is not synchronized with other motions in the locomotion set.