Driving Entities with Maya Fields
The desired result.
Characters all moving straight forward and playing the same animation, but with different start frames
What not to do.
The intuitive way to do this would be to use a single Motion behavior and configure its start percent to have entities starting at random frames. but doing it this way will bring characters all moving in different directions instead of moving in the same one.
Result of applying a Motion behavior with random start percent between 0 and 1
The reason it's not working is that each frame in the motion has a different orientation, and thus bring a different main orientation of the displacement.
What to do.
The best way to achieve the desired effect is to drive the character's direction from their particle (and an uniform field, for instance) and their animation from a specifically configured Locomotion behavior. Here is the step by step process.
Step 1 - drive the particles' positions
Start with an empty behavior for the entity, and a uniform field on the particles to move them in the desired direction.
Entities should now be moving in the correct direction, but with no animation on it.
Step 2 - add and configure the locomotion behavior
Next step is to add a Locomotion behavior and add the single animation file that should be played on the character. The following attributes should be changed:
- "Create neutral animation if needed" attribute in the Locomotion Attributes should be unchecked;
- "1st Motion Replay Ratio" attribute in the Locomotion Attributes should be set to 0.
The start percent attributes should also be configured to obtain the desired animation diversity (either with a random, or with pp attributes)
Entities should now be moving with the correct animation and frame offset, but depending on the way the uniform field was configured, some might be trying to circle back to their starting point (which is not the desired effect yet).
The reason for this behavior is that the particles are moving slower than the animation files. The locomotion try to reach back the particle's position, and thus turn in circle to go back behind.
Step 3 - Fine tune the configuration of uniform fields
To fix this, the uniform field's magnitude have to be corrected to ensure the particles are always going at the same speed or faster than the animation (it's not a problem if the particle's are going faster than the animation, so there is no need to try to match the exact same speed than the animation's speed).
A uniform field magnitude of 60 is enough in my case to ensure that the particle is moving faster than the character
Note that whatever speed you use in the uniform field, the character will move with the speed of the animation only (because there is one and only one animation in the locomotion behavior, there is no blend with other animations to fix the speed).
That's it, our characters are finally moving all straight forward with different start frames