This module creates all the nodes needed by the state machine (clip reader, merge, state machine) inside the DG network of each agent; then, the "state" metadata is used to play the right animation clip based on the data from the state machine.
Setup
Create an agent group.
Add a grid layout module and set the size attribute to (3,3,1).
Add a state machine module.
Set a valid id number in the state attribute of the state machine module
Press play
You can override the state of some agents with other state ids if your state machine has any.
Press play.
Set start frame
The start frame property controls the start frame of the clip. If you put -1, every agent uses a random value. If you want to set a specific frame on some agents. Open the start frame override dialog. Select the agents from the dialog or using the layout tool. Set a valid frame inside the value field and press the set value button. You can use blueprint to set the start frame using the SetFrame() and SetFrameOverride blueprint function of the clip reader component. Please remember to call it in the init simulation event.
Change state
You can change the agent state using the state property. You can use the state override or the blueprint function SetState() and SetStateOverride() to change an agent state. This can be called during the simulation. You can also control the agent’s state using the “state“ int metadata on each agent. If you want to change the metadata during the simulation instead to call the SetState/StateOverride(), please remember to check the “Set State at Creation Only” property. Otherwise, at every tick, the state machine component will overwrite the metadata value.
Change velocity
Change the frame rate property to change the agent velocity. You can the velocity using the SetFrameRate() and SetFrameRateOverride() function of the state machine component. The agent velocity can also be changed using the “frameRate“ double metadata of each agent. If you are going to change this metadata during the simulation, please remember to check the “Set Frame Rate at Creation Only“ properties. Otherwise, at every tick, the state machine component will overwrite the metadata value.