Miarmy Crowd Simulation Documentation (English)

Expression Control

Introduction

There is an Expression Control Mode in the decision node, which allows us that use expressions or scripts to directly control the output result of a sentence.


Video Tutorial

Advanced Tutorials Variable & Expression part


Instructions

Switch the mode of decision node from normal to the “expression” mode.

Please notice in this mode, only 1 input and 1 output channel available.

expression mode of decision node

only 1 input and 1 output available


Sentences Tim

Input condition:

You can choose any one sentence from GUI, and then delete the arithmetic part of sentence ( < ??) or ( from ?? to ?? ) or ( < ?? ) or (LEFT/RIGHT/UP/DOWN) etc...

For example:

  • spot to me distance < ??
  • spot to me distance

 

  • my type ID from ?? to ??
  • my type ID


Output decision

you can choose any one sentence from GUI, and then delete the value content part of sentence ( ?? )

For example:

  • move FORWARD as speed ??
  • move FORWARD as speed

 

  • set maya attribute:??? value ??
  • set maya attribute:??? value




Example 1

Using sentence return value to control Head Translate Offset

(Noise ID) rand float based on my id

(Bone Offset) set my bone:head translate Y offset

head offset directly controlled by expression


Example 2

Using sentence return value to control expression and then control the Head Translate Offset

(Agent ID) my ID

giving agent id value to attribute "aaa"

use my ID -> aaa -> expression -> control the head bone Y offset

head offset Y controlled by value of agent ID


Please notice that, do not contain "blanks" in python code session:

maya python:${aaa}+0.1 (correct)

maya python:${aaa} + 0.1 (incorrect)


Additionally, you can use real python command to control this:

maya python:abc(${aaa})


define a python command:

def abc(var):

  return var * 5






Basefount Technology