In this section we add some behaviours using some behaviours module to some agents group.
Animation modules
These behaviour modules handle and interact with the animation clip
Clip reader behaviour module
This module attach a clip reader node to each agent, so every agent will play in loop a specific clip
- Create an agent group
- Add a grid layout module and set the size attribute to (3,0,3)
- Add a clip reader module
- Set a compatible clip in the clipName attribute of the clip reader module
- If you want set a different clip for some agents press the icon next to the clipName field. Select the agent you want from the list inside the agents override dialog or use the "Agent selection tool" (you can activate the seleciton tool using the button in the settings panel of the agent group aetemplate) and set a clip name there.
- Rewind your scene and the press play
State machine behaviour module
This module creates all the clip reader, merge, state machine nodes 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.
- Create an agent group
- Add a grid layout module and set the size attribute to (3,0,3)
- Add a state machine module
- Set a valid id number in the state attribute of the state machine module (if you are using the atomsRobot agen type, use 1 for the walk state)
- Rewind your scene and the press play
- The state attribute can be animated, so put a keyframe at frame 20 with value 1 and one at frame 21 with value 2
- Rewind your scene and the press play
- You can override the state of some agent using agents override dialog
Sync behaviour module
The sync module is used to syncronize agents and create a parent/child or constraint relation between agents of different agent group, please look at the sync module section for more information.
Directional modules
To drive your agents you can use different behaviour modules, these modules change the "direction" metadata of the agents.
Follow curve behaviour module
Let's start with the follow curve module.
- Create a agent group
- Add a grid layout module
- Add state machine module. Set the "state" attribute of the stateMachine module to 1
- Create a curve in your scene
- Add a follow curve module
- in the curve attribute of the follow curve module drag and drop form the outliner the curve or enter the curve name inside the attribute field
- Rewind your scene and the press play. The agent will follow the curve you created
Curve field behaviour module
The curve field generate a vector field using multiple effects so the agent are affeted by the direciton of multiple curves
- Create a agent group
- Add a grid layout module, Set the size to (3,0,3)
- Add state machine module. Set the "state" attribute of the stateMachine module to 1
- Create some curves in your scene
- Add a curve field module
- in the curves attribute of the curve field module, expand the panel and press the add button to add input curves and then drag and drop from the outliner the curves or enter the names inside each field
- Set max distance attribute to 500
- Rewind your scene and the press play. The agents will follow the curves you created
Mesh avoidance behaviour module
With this module you can avoid the intersection between agents and geometries in your scene
- Create a agent group
- Add a grid layout module
- Add state machine module. Set the "state" attribute of the stateMachine module to 1
- Create a curve in your scene
- Add a follow curve module
- In the curve attribute of the follow curve module drag and drop form the outliner the curve or enter the curve name inside the attribute field
- Create a cube or some geo in your scene. If you are going to create multiple geos, please remenber to combine all together
- Add a mesh avoidance module
- In the mesh attribute of the mesh avoidance module drag and drop form the outliner the geo or enter his name inside the attribute field
- Rewind your scene and the press play. The agent will follow the curve you created avoiding the geos
Please remember that the module are evaluated from top to down. In this case the mesh avoidance shoudl be at the bottom because it shoudl override the direction that comes from the follow curve module. If you put the mesh avoidance module before the follow curve you will have a wrong behaviour because the follow curve will override the directions formt he mseh avoidance module
There are others directional modules, please have a look to the behaviour modules reference section
Area trigger behaviour module
With this module you can change a metadata value when the agents enter inside a mesh area
- Create a agent group
- Add a grid layout module and set the size to (5,0,5)
- Add state machine module. Set the "state" attribute of the stateMachine module to 1
- Create a curve in your scene
- Add a follow curve module
- In the curve attribute of the follow curve module drag and drop form the outliner the curve or enter the curve name inside the attribute field
- Create a plane, scale it and put it in front of the agents
- Add a area trigger module
- Connect the plane to the mesh attribute of the area trigger, you can drag&drop from the outliner or write the plane name in the mesh field
- Connect the plane translate,scale,rotate to the agentGroupShapeNode1.atoms_areaTrigger_meshTranslation/Rotation/Scale
- Set the metadata attribute in the area trigger module to state
- Set the intValue attribute in the area trigger module to 2 in this way the agents will change the state to 2
- Set the keepValue on so the agents will keep the new state value
- Add another area trigger module and create and attach a new plane
- Inside the new area trigger module, set the metadata to frameRate and the doubleValue to 0.5, the keepValue to off
- Set the Blend In Frame and Blend Out Frame attribute of the new trigger module to 10
- To add more variation to your simulation set the Reandom In and Random Out to 5
- Rewind your scene and the press play. Now when the agents enter inside the first plane they'll start to run because the state metadata is changed to 2, then when they enters in the second plane they slow down but only inside the plane.
Network editor behaviour module
With this module you can edit the dependency graph of the agents, let's create a follow target behaviour with this module
- Create a agent group
- Add a grid layout module
- Add state machine module. Set the "state" attribute of the stateMachine module to 1
- Create a locator and then at frame 0 move to (0,0,400) and add a keyframe, then at frame 50 move to (400,0,400) and add a keyframe, at frame 100 move to (400,0,0) and add a keyframe
- Select the agent group and add a network editor module
- Press the "Open Network Editor" button sinde the module options
- Now press tab and enter "ExposeVector3", select it form the list and press enter. This node expose an attribute to maya.
- Double click on the new node created to expand it and on the inspector widget on the right change the name of the node to targetPosition
- Now create a "getAgentVectorMetadata" node and connect the globalTime.out port to the time input of the new node, in the inspector set the name attribute to "position". This node read the position metadata fo the agent
- Create a "SubtractVector" node and on the first input conenct the output of the targetPosition node and on the second input connect the output of the getAgentVectorMetadata
- Create a NormalizeVector node and connect the output of the SubtractVector node
- Create a setAgentVectorMetadata, set the name attribute to "direction" and then connect the output fo the normalizeVector node to the in port.
- Connect the out port of the setAgentVectorMetadata node the the first input of the preBuildPoseNode.
- Form the File menu press on Register to save our network, or press ctrl+s
- Rewind the scene and then connect the locator.translate to tcAgentGroupNodeShape1.atoms_networkEditor_targetPosition
- Rewind the scene and press play
For more information about the network editor module please look at this section.
Pose modules
The pose modules affect the joints transformation
Agent scale behaviour module
This module can change the scale of each agent
- Create a agent group
- Add a grid layout module and set the size attribute to (5,0,5)
- Add state machine module
- Add an agent scale module and set the scale attribute of the module to 2
- Rewind the scene
- To add more variation open the override dialog of the scale attribute, select some agents form the list, then press the "Value:" button and enter a range of 0.5-2.5, then press randomize.
- Rewind the scene
Joint transfrorm behaviour module
This module override or add an offset transformation to a joint
- Create a agent group
- Add a grid layout module and set the size attribute to (5,0,5)
- Add state machine module
- Add a joint transform module
- Set the jointName attribute to "Head"
- Set rotate to (0,90,0)
- Set offset to on
- Rewind the scene
- You can also change the weight or add some keyframe to it
Parent constraint behaviour module
This module create a constraint between the agents and an object in your scene
- Create a agent group
- Add a grid layout module and set the size attribute to (5,0,5)
- Add state machine module
- Add a parent constraint module
- Create a locator add a keyframe at frame 0, then at frame 50 move to (500,0,500) add some rotation and scale and add another keyframe
- Connect locator1.worldMatrix to tcAgentGroupNodeShape1.atoms_parentConstraint_parentMatrix
- Rewind the scene and press play
Joint aim behaviour module
This module change the orientation of one joint in order to aim a point. It can also propagate the transofrmation to hi parents
- Create a agent group
- Add a grid layout module
- Add state machine module
- Create a locator and move to (400,0,400)
- Add a joint aim module
- Set the joint to "Head"
- Set the aim axis to Z
- Set hierarchy propagation to 5
- Rewind the scene and press play
Joint constraint behaviour module
This module create a parent constraint betweek two joints of the same agent. THis is usefull to constraint prop joint to the agent if the prop is not animated
Tilt behaviour module
This module add a tilt transformation to the agents based on the slope of the group
- Create and agent group
- Add a grid layout module
- Add a state machien module and set the "state" attribute to 1
- Create a groud mesh with some hills
- Open the height field manager from the Atoms menu Atoms→Height field manager
- Select the ground and in the Height field menager press the ad button
- Set the heigh field name to "hf" and press the select button to set the mesh and press ok
- On the steate machine module set "hf" as height field and rewind the scene
- Add the tilt module
- Set the height field attribute of the tilt module to "hf"
- Set the agent up adn down angle to 5 and the ground up and down angle to 10
- Set the maxTiltAngleRate to 0.5
- Rewind the scene and press play
- Try to disable the tilt module using the checkbox near the module name reqind and press play to see the difference with and without the tilt module
Please check the behaviour modules reference page for the full list of modules available