Expressions

Expressions are pseudo-code instructions which allow to perform simple mathematical operations on various source of data. Data can come from PPAttributes, Channels, Ramp nodes... Expressions can be used in the Attribute and Set Bone Behaviors or in the Expression Trigger in Triggers. The syntax for the expression is:

[Operand1] [operator] [Operand2] where [operator] and [Operand2] are optionals.

Expresion results are only of type float or vector3.

Expression with exponential values, such as 1e5 or 10.3e-6 will be interpreted as channels, please avoid using exponential notations.

Operands

Available operands are:

Constant a constant float or vector3 value: 0.5, 1, <<1., 2., 3.>>...
PPAttribute a float of vector3 PPAttribute name: particleId, mass, position (for more information about how to use ppAttributes, see ppAttributes Handling).
MEL Expression any MEL expression which returns a float value: getCurrentTime(). The MEL expression can contain special tags such as #pid#, #ps#, #gid# or #tid# to interact with particles, or ##channelName## to use a Channel (see Technical Documentation).
Channel a Channel name in the form entityName.(behaviorName).channelName.(componentName). Several entityNames are available:
  • this to specify the current Entity running this Expression: this.beMotionShape1.motionId.
  • master to specify the current Master Entity (when using a Master-Slave Behavior) : master.beMotionShape1.isRunning
  • closestEntity to specify the closest Entity to the current Entity running this Expression: closestEntity.position.
  • closestEntityOfTypeX to specify the closest Entity of Entity Type X to the current Entity running this Expression: closestEntityOfType2.scale.
  • entityX to specify a specific Entity of Id X: entity5001.beGotoShape1.isRunning.

The complete list of Chanels and other examples of valid Channel Names can be found here.

Ramp

a Crowd Ramp identifier which is connected to the Crowd node which allows to use Expressions: #ramp0# which will correspond to the Crowd Ramp node connected at slot [0] in the Crowd node:

Golaem Attribute

a Golaem Attribute feeding the Vector target

 

Operators

Available operators are +, -, *, /, %

Expression Examples

Here are a couple of examples of valid Expressions:

  • 2.5
  • <<1.2, 2.4, 3.6>> * 2
  • FloatPPAttr + 0.1
  • FloatPPAttr % 100
  • VectorPPAttr - << 1, 0, 0 >>
  • VectorPPAttr * 2
  • VectorPPAttr[x] / FloatPPAttr
  • MELCommand(#eid#) - VectorPPAttr[y]
  • this.beMotionShape1.currentRatio * 100
  • this.bonePosition.LeftArm
  • this.bonePosition.LeftArm[z] + this.bonePosition.RightArm[z]
  • this.boneOrientation.RightArm * <<2., 0., 1.5>>
  • this.renderingTypeId + FloatPPAttr
  • closestEntityOfType2.beLocomotionShape1.linearVelocity / 2
  • entity5001.paintedColor + <<1., 0., 0.>>
  • #ramp1# * 180