Layouting agents - Houdini
In the previous section you already created some agents. In Atoms there are a couple of layout modules you can use to layout your agents in the scene.
Grid layout
The grid layout creates a grid of agents.
Create an agent group. Add a gridLayout module. From the grid layout modules parameters tab, type the agent type name you entered previously in the "agentType" field (i.e. testMan). and set the "size" field to (3,1,3). Then add a stateMachine module. From the "Draw attribute" tab change the draw mode from skeleton to skin.
Hit the play button to run the simulation.
Points layout
With the points layout you can choose the exact location where the agents must be created or you can use the input points a geo node.
Agents Layout tool
Create an agent group. Add a pointsLayout module. Then add a stateMachine module. From the "Draw attribute" tab change the draw mode from skeleton to skin.
Rewind.
Go inside the "Modules Attribute" and "pointsLayout" tab in the property editor, then click on "Agent Layout Tool" button or press Return while the agent group node is selected (alternatively you can open the layout tool from the Atoms menu: Atoms->Tool->Agents Layout Tool). Press P to open the agents layout tool widget. Press S or click on the icon, move the mouse over the viewport. A green arrow indicates where you are going to create an agent and its direction. Press the LMB to create an agent. To change direction press CTRL+LMB and drag the cursor to the left/right. You can create multiple agents at once by pressing the icon.
After creating some agents you can still edit their position, direction and change their agent type. Press the Q button or use the icon, select some agents. Then press the A button or the icon and use the move manipulator to move the agents in the scene. To rotate the use the Z button or the icon.
From the tool UI you have access to more action for each different mode. For example, go back to the selection mode and from the UI press "delete agents" to delete them. An option for changing the agent type is also available.
Using input points
If you connect a geo node to the agentGroup node, the points layout module will use the input points of the incoming mesh to generate agents. You can control the agent direction and agent type by adding the atoms_pointsLayout_directions and atoms_pointsLayout_agentTypes point attributes. You can pass also the agent group ids using the atoms_pointsLayout_ids point attribute.
Create an agent group. Add a points layout module and a state machine module. Add a grid as input of the agentGroup1 node and set the grid size to 1000. Now add an "attribute Create" node between the grid and the agentGroup1 node. Inside the attribute create node properties, set the name to atoms_pointsLayout_directions and the type to vector. Now set the value to 1,0,1. Try experimenting a little by creating a scatter node after the grid1 object to randomly place the agents on the grid mesh.
Mesh scatter layout
The mesh scatter layout creates randomly agents on a input mesh.
Create a grid, and scale it to 150,1,150
Create an agent group and add a meshScatterLayout module and a stateMachine module.
Set the "radius" field to 150 and the iterations to 100. Set the mesh to grid. And set the matrix as in the image on the left. If you scaled the sop grid and not the obj grid you can leave the matrix at 1.
Hit the play button to run the simulation.
Curve layout
The curve layout creates agents along an input curve.
Create a curve, and scale it to 150,1,150
Create an agent group and add a curveLayout module and a stateMachine module.
Set the curve you created inside the "curve" attribute of the curveLayout module .
Hit the play button to run the simulation.
Stadium layout
The stadium layout creates an arena of agents.
Create an agent group, please make sure the attribute editor is visible and the agent group node is selected.
Click on the "Add" button and add a stadiumLayout module. Type the agent type name you entered previously in the "agentType" field (i.e. testMan).
Set the "size" field to (500,500,100),the shapeType to 1 and the steps to 5. Click again on the "Add" button and add a stateMachine module.
Offset behaviour module
The offset behaviour module can be used to modify an existing behaviour, so can be used with the grid layout module or any other layout module. It is also supported by the "Agent Layout Tool".
- Create an agent group
- Attach a grid layout module and set the size attribute to (5,0,5)
- Add a state machine module
- Add an offset behaviour module
- Select the agent group and activate the "Agent Layout Tool" from the Atoms menu Atoms → Tools → Agents Layout Tool
- Press the Q button or use the icon, select some agents
- Press the A button or the icon and use the move manipulator to move the agents in the scene. To rotate the use the Z button or the icon.
- Add an agent filter behaviour module
- Open again the "Agent Layout Tool"
- Select some agents
- From the Agent layout tool ui press the Delete agents button
- Rewind your scene and press play
Layouts can be combined together:
Almost all layouts can also generate agents dynamically, please follow this video to know more:
You can modify your layouts with the layout tool:
Copyright © 2017, Toolchefs LTD.