Adding behaviours - Houdini

In this section we are going to have a look at some behaviour modules.


Animation modules

These behaviour modules handle and interact with the animation clips.

Clip reader behaviour module

This module attaches a clip reader node to each agent, so every agent will play a specific clip

  • Create an agent group.
  • Add a grid layout module and set the size attribute to (3,1,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 and set a clip name. You might also select the agents with the agent layout tool.
  • Rewind your scene and the press play.



State machine behaviour module

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.

  • Create an agent group.
  • Add a grid layout module and set the size attribute to (3,1,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 man agent type, use 1 for the walk state).
  • Rewind your scene and the press play.
  • The state attribute can be animated, so put a key frame 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 synchronize agents and create a parent/child or constraint relationship 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 an 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.
  • Type the curve path or select it with the buttons on the right.
  • Rewind your scene and the press play. The agent will follow your curve.
  • You can also animate the curve and set the max distance and weight to change the curve influence.


Curve field behaviour module

The curve field generates a vector field using multiple curves so the agents are affected by the direction of multiple curves

  • Create an agent group.
  •  Add a grid layout module, Set the size to (3,1,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.
  • Add few entries in the curve list and assign your curves.
  • 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 an 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
  • Assign the curve to the curve parameter.
  • Create a cube or some geo in your scene. If you are going to create multiple geos, please remember to combine all together.
  • Add a mesh avoidance module.
  • Assign the mesh to the mesh parameter.
  • 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 should be at the bottom because it should 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 from the mesh 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 an agent group
  • Add a grid layout module and set the size to (5,1,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
  • Assign the curve to the curve parameter.
  • Create a grid, scale it and put it in front of the agents
  • Add a area trigger module
  • Assign the mesh to the mesh attribute.
  • 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 Random In and Random Out Delay 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.



Pose modules

The pose modules affect the joints transformation.



Agent scale behaviour module

This module can change the scale of each agent

  • Create an agent group.
  • Add a grid layout module and set the size attribute to (5,1,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 transform behaviour module

This module override or add an offset transformation to a joint

  • Create an agent group.
  • Add a grid layout module or a point layout.
  • Add state machine module.
  • Add a joint transform module.
  • Set the jointName attribute to "Head".
  • Set rotate to (90,0,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 an agent group.
  • Add a grid layout module and set the size attribute to (5,1,5).
  • Add state machine module.
  • Add a parent constraint module.
  • Create a null, add a keyframe at frame 0, then at frame 50 move to (500,0,500), rotate, scale it and add another keyframe.
  • Connect null translate/rotate/scale parms to parent constraint translate/rotate/scale parms.
  • 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 transformation to hi parents

  • Create an agent group.
  • Add a grid layout module.
  • Add state machine module.
  • Create a null and move to (400,0,400).
  • Add a joint aim module.
  • Connect null translate parm to joint aim translate parm.
  • Set the joint to "Spine2".
  • Set the aim axis to Z.
  • Set hierarchy propagation to 5.
  • Rewind the scene and press play.



Joint constraint behaviour module

This module creates a parent constraint between two joints of the same agent. This is useful in cases where a constraint prop joint is not animated and you want to attach it to an hand joint.


Tilt behaviour module

This module add a tilt transformation to the agents based on the slope of the group

  • Create an agent group
  • Add a grid layout module
  • Add a state machine module and set the "state" attribute to 1
  • Create a ground 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 manager press the ad button
  • Set the height field name to "hf" and press the select button to set the mesh and press ok
  • On the state 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 and 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 rewind and press play to see the difference.




Vex behaviour module

The vex behaviour module execute some vex context for each agents at different stage of the simulation. Is it possible to use any Houdini vex function/node to be able to access to any Houdini data.

  • Create an agent group
  • Add a grid layout module
  • Add a state machine module and set the "state" attribute to 1
  • Add a vex module
  • On the vex module attributes, press the "Create VOP" button next to the initFrame field. This create a vex context called at the init frame stage.
  • Go inside the vop node created
  • Create a "Set Agent Metadata" vex node. Then set the signature parameter to vector, the metadata name to direction and the default value to 1,0,1
  • Connect the agentId of the global node to the agent id of the set agent metadata node
  • Press the updateSim button inside the atoms shelf
  • Rewind the scene and press play



Please check the behaviour modules reference page for the full list of modules available.

Copyright © 2017, Toolchefs LTD.