Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • agent: is an AgentWrapper object. You can use it to access agent metadata, or pose transforms.

  • agentGroup: is an AgentGroupWrapper object. You can use it to access other agents or do space queries.

  • defaultValue: it contains the default value of the attribute.

and an output variable called “output”. You need modify the output variable passing the attribute value that you wantFinally, you can change the attribute value by assigning a value to the “output” variable.

Example

Create an agent group and add a grid layout and a state machine module.

...

Add the expression like in the picture below and press save.

...

if If you press play, the agent switches its state to 1 when the frame is higher then 20.

For example if you want that only the agent with groupId 1 switches to switch to state 1, you can write an expression like this:

Code Block
languagecpp
if (agent.groupId == 1 && agentGroup.time() > 20)
{
	output = 1;
}
else
{
	output = defaultValue;
}

Or when You can do the same by checking if an agent has a specific metadata value:

Code Block
languagecpp
if (agent.getIntMetadata("myMeta") == 1 && agentGroup.time() > 20)
{
	output = 1;
}
else
{
	output = defaultValue;
}