Adding a terrain

Atoms can place agents on different type of terrains using built-in height fields and gravity fields.


Basic terrain
  • Create an agent group.
  • Add a grid layout module and set the size attribute to (5, 1, 5 ).
  • Add a state machine module and set the state attribute to 1.
  • Create a bumpy ground.
  • Open the height field manager from he Atoms menu Atoms → Height field manager.
  • Select the terrain mesh.
  • Press the Add button,  in the dialog name field type a name (i.e. "ground").
  • Press the select button to automatically fill the mesh field with the ground path.
  • Press Ok, close the height field manager and rewind your scene.
  • Select the agent group.
  • In the state machine module options, set "ground" as height field.
  • Rewind your scene and press play. Atoms will place the agents on the mesh.


Your height fields need to be reloaded whenever they are modified. Open the Height field manager, right click on your height field item and choose reload.



Deformed terrain
  • Create an agent group.
  • Add a grid layout module and set the size attribute to (5, 1, 5 ).
  • Add a state machine module and set the state attribute to 1.
  • Create a plane and increase the subdivision to 50 50 and scale to 3000,3000,3000.
  • Add a wave deformer, set the amplitude to 0.1 and put some keyframes on the offset attribute to animate the deformation.
  • Open the height field manager from he Atoms menu Atoms → Heigh field manager.
  • Select the terrain mesh.
  • Press the Add button,  in the name field of the dialog set a name (i.e. "ground").
  • Press the select button to automatically fill the mesh field with the ground path.
  • Check the animated checkbox.
  • Press Ok, close the height field manager and rewind your scene.
  • Select the agent group.
  • In the state machine module options, set "ground" as height field.
  • Rewind your scene and press play. Atoms will place the agents on the deformed mesh.


Atoms rebuilds the animated height field internal structure at every frame. For dense meshes this could lead to performance slow downs. If your ground is a static mesh moving in space, please have a look at the following section.



Animated undeformed terrain

If your ground transform is animated (but the mesh itself is static), you can use the parent constraint module to speed up the ground computation without using an animated height field.

  • Create an agent group.
  • Add a grid layout module and set the size attribute to (5, 1, 5 ).
  • Add a state machine module and set the state attribute to 1.
  • Create a plane and increase the subdivision to 15 15 and scale to 3000,3000,3000.
  • Put the plane inside a group and animate the transform of the group adding some keyframes.
  • Open the height field manager form he Atoms menu Atoms → Height field manager.
  • Select the terrain mesh.
  • Press the Add button,  in the name field of the dialog set a name (i.e. "ground").
  • Press the select button to automatically fill the mesh field with the ground path.
  • Check the animated checkbox.
  • Press Ok, close the height field manager and rewind your scene.
  • Select the agent group.
  • In the state machine module options, set "ground" as height field.
  • Add a parent constraint behaviour module and rewind the scene.
  • Connect group1.worldMatrix to tcAgentGroupNodeShape1.atoms_parentConstraint_parentMatrix.
  • Rewind the scene and press play.





Gravity fields and 3d terrains

Gravity fields are standard height fields but they are used to modify the agent gravity and up vector metadata. You can create a number of effects using gravity fields. Here are two examples:

  • Create an agent group.
  • Add a grid layout module and set the size attribute to (5, 1, 5).
  • Add a state machine module and set the state attribute to 1.
  • Create a sphere, scale it to (1000,1000,1000) and move to (0, -1000, 0).
  • Create an height field using this sphere and set its name to "gravityMesh".
  • Duplicate the sphere and model some bumps on the new sphere.
  • Create a new height field using this sphere and set the name to "groundMesh".
  • Select the agent group.
  • In the state machine module options, set "groundMesh" as height field and "gravityMesh" as gravity field.
  • Rewind your scene and press play.



  • Create an agent group.
  • Add a grid layout module and set the size attribute to (5, 1, 5).
  • Add a state machine module and set the state attribute to 1.
  • Create a simple plane and scale it to (1000,1000,1000).
  • Create an height field using this plane and set the name to "groundMesh".
  • Duplicate the plane and rotate it to (30, 0, 0).
  • Create a new height field using this plane and set the name to "gravityMesh".
  • Select the agent group.
  • In the state machine module options, set "groundMesh" as height field and "gravityMesh" as gravity field.
  • Rewind your scene and press play.




Copyright © 2017, Toolchefs LTD.