Synchronizing agents

To synchronize agents you can use the "sync" modules. It is particularly useful with horse/rider setup or any other setup where you need to synchronize or constraint agents from different groups.

Let's see an example of a horse/rider setup.


Asset preparation

Since your agents will be synced by Atoms during the simulation, their animation clips should be synchronized before you export them to an animation clip file (i.e. Fbx).

A good practice is to add an extra joint to the horse and constrain the rider main pelvis to it. Alternatively you can bake the animation of the rider main pelvis and the copy it to the horse extra joint.

Export the animation clips as usual and load them inside Atoms alongside with your agent types.


Set the agent group order

Create two agent groups with a layout module (i.e. grid layout) and a clip reader or state machine module. On the first agent group set the "agentType" to "horse", and on the second one set it to "rider".

During the simulation Atoms computes sequentially the agent groups in the scene. In this case the agent group containing the horses should be computed first. In order to do that you should select the horse agent group and then the rider agent group (in this order). Then press the sync command from the Atoms shelf.

Under the hood a connection is made between the "message" attribute of the horse group and the "parentAgentGroup" attribute of the rider group.



Adding the sync module

The last step is to add the sync module to the rider agent group. This module copies some metadatas from the parent to the child agents. It also overrides the current layout module, for this reason you need to set the sync module "agentType" field to "rider". You must also set the "parentJoint" name (the driver joint) and the rider "joint" name (the driven joint).

Finally, you might as well add an offset and activate the keepOffset checkbox to maintain the child joint animation. If the keepOffset is off then the module applies a normal constraint without offset. If you need to copy more metadatas, expand the "metadata" list and add the metadata names you want copy from the parent agents.

Rewind the scene and you will see the riders constrained to the horses.


When using the sync module for constraining props, please add a clipReader or stateMachine module before the sync module, even though the parameters will be left empty.
This is because the clipReander and stateMachine modules add a pelvis operator to each agent of the group which is needed by the sync module.

Copyright © 2017, Toolchefs LTD.