Expression reference

 
 
 

This section lists the expressions supported by MotionBuilder. Each is shown with an example you can use as a guide when building expressions.

Mathematical expressions

The following are mathematical expressions:

DISTANCE Description
Purpose Finds the distance between two vectors.
Syntax distance(vector1, vector2)Point1 and point2 should be two positions in 3D space.
DISTANCE NUMBERS Description
Sends The distance between the two numbers.
Syntax SetDistanceNumbers
GO TO BEGIN Description
Purpose When triggered (the value is changed from 0 to 1), the Transport Controls move to the start of the take.
Syntax Gotobegin (A2)
GO TO END Description
Purpose When triggered (the value is changed from 0 to 1), the Transport Controls move to the end of the take.
Syntax GotoEnd (bool)
GO TO POSITION Description
Purpose When triggered (the value is changed from 0 to 1), the Transport Controls move to a specified position.
Syntax GotoPosition (cell)
LENGTH Description
Purpose Finds the length of a vector.
Syntax length(vector)
MIDDLE POINT Description
Returns The position vector dependent on the ratio between the two position’s vectors.
Syntax middlepoint(vector1,vector2,number)Vector1 is a position vector. Vector2 is a position vector. Number is a real number that represents the position ratio between the two positions’ vectors.
NORM Description
Returns The normalized vector. Vector is the vector you want to normalize.
Syntax norm(vector)
PLAY MODE Description
Purpose Changes the value of the playback mode.
Syntax SetPlayMode
PLAY BACKWARD MODE Description
Purpose Changes the value of the playback mode.
Syntax SetPlayBackwardMode
POW Description
Returns The result of a number raised to a power.
Syntax number1^number2 Number1 is the base number. It can be any real number. Number2 is the exponent, to which the base number is raised.
PRODUCT Description
Purpose Multiplies its arguments.
Syntax 1 number1*number2 Number1 is the number that you want to multiply with number2.
Syntax 2 vector1*vector2 Vector1 and vector2 combine to give you the cross product.
QUOTIENT Description
Purpose Number2 is the number by which you want to divide number1.
Syntax number1 / number2
RECORD MODE Description
Purpose Changes the value of the Record mode.
Syntax SetRecordMode
STEP FORWARD Description
Syntax StepForward (cell)When triggered (the value is changed from 0 to 1), the Transport Controls move one step forward.
STEP BACKWARD Description
Purpose When triggered (the value is changed from 0 to 1), the Transport Controls move one step backward.
Syntax StepBackward
SUM Description
Purpose Adds two arguments.
Syntax 1 number1 + number2 Number1 and number2 are the numbers or numerical cells that you want to add.
Syntax 2 vector1 + vector2Vector1 and vector2 are the vectors or vector cells that you want to add.
SUB Description
Purpose Substitutes arguments.
Syntax 1 number1 - number2 Number1 is the number that you want substituted by number2.
Syntax 2 vector1 - vector2 Vector1 is the vector that you want substituted by vector2.

Numerical functions

The following are expressions of numerical functions:

ABS Description
Returns The absolute value of a number or cell.
Syntax abs(number)
ACOS Description
Returns The arccosine of a number. Number is the cosine of the angle you want.
Syntax acos(number)
ASIN Description
Returns The arcsine of a number. Number is the sine of the angle you want.
Syntax asin(number)
ATAN Description
Returns The arctangent of a number. Number is the tangent of the angle you want.
Syntax atan(number)
ATAN2 Description
Returns The arctangent from X and Y coordinates.Number1 is the X-coordinate of the point.Number2 is the Y-coordinate of the point.
Syntax atan2(number1,number2)
COS Description
Returns The cosine of a number. Angle is the angle in radians for which you want the cosine.
Syntax cos(angle)
DEG2RAD Description
Converts Degrees to radians. Angle is the angle in degrees that you want to convert.
Syntax deg2rad(angle)
EXP Description
Purpose Number is the exponent applied to the base value e.
Syntax exp(number)
INTEGER Description
Purpose Rounds numerical values down to the next full digit.
Syntax integer
LN Description
Returns The natural logarithm of a number. Number is the positive real number for which you want the natural logarithm.
Syntax ln(number)
LOG Description
Returns The base-10 logarithm of a number. Number is the positive real number for which you want the base-10 logarithm.
Syntax log(number)
ONEOVER Description
Returns The result of 1/number. Number is the positive real number for which you want 1/number.
Syntax oneover(number)
PULL NUMBER Description
Purpose Continuously takes the value from the input parameter and stores the result in its internal buffer, which is then used as the Result value. This gives you the same value as the last evaluation.
Syntax pull
PRECISION NUMBERS Description
Purpose Cuts the number at a specified precision value, for example, if a = 12.36 and the assigned precision value is 0.1, then the output is 12.30.
Syntax precision(number)
RAD2DEG Description
Purpose Converts radians to degrees. Angle is the angle (in radians) that you want to convert.
Syntax rad2deg(angle)
SIN Description
Returns The sine of the given angle. Angle is the angle in radians for which you want the sine.
Syntax sin(angle)
SQRT Description
Returns A positive square root. Number is the number for which you want the square root.
Syntax sqrt(number)
TAN Description
Returns The tangent of a number. Number is the angle in radians for which you want the tangent.
Syntax tan(number)

Other functions

The following are miscellaneous expressions:

BUFFER Description
Returns The old value when current value is off.
Syntax1 buffer(vector,number) Vector is a vector. Number is a Boolean number, and can be switched on or off.
Syntax2 buffer(number1,number2) Number1 is a real number.Number2 is a Boolean number, and can be switched on or off.
DAMPING Description
Purpose Applies damping to a numerical value.
Syntax damping(number)
DAMP (Clock based) Description
Purpose Similar to Damping, except this expression is based on the MotionBuilder clock instead of the refresh rate. This relation is recommended over the Damp relation, as that makes your scene identical on every computer.
Syntax damp3dclockbased
DAMP (3D) (Clock based) Description
Purpose Similar to Damp (clock-based), except this expression is based on the Damp (3D) relation.
Syntax damp3dclockbased
DAMPING (3D) Description
Purpose Damps the position of a vector using a specified damping factor.
Syntax damping3d
PRECISION VECTOR Description
Purpose Use this constraint to apply a precise value to every component of the vector: X, Y, and Z can each have different precision values.
Syntax precisionVector
Receives a (Number) and Precision (Number)
Sends Result (Number)
PULL VECTOR Description
Purpose Continuously pulls the vector from the input parameter and stores the result in the internal buffer, which is then used as the Result value. This value gives you the value of the last evaluation.
Syntax pullVector
PULSE Description
Purpose Sends an alternating stream of zeroes and ones at the specified frequency, for example: 010101010101.
Syntax pulse
TRIGGERED PLUS MINUS COUNTER Description
Purpose Creates a trigger to add the increment/decrement.
Syntax triggeredplusminuscounter
TRIGGERED RANDOM Description
Purpose Generates a random number on demand.
Syntax triggeredrandom

Rotation expressions

The following expressions are used for rotation functions:

3 POINTS ROTATION Description
Returns A rotation value.
Syntax point3rotation(vector1,vector2,vector3) Vector1, vector2, and vector3 are vectors that represent three discrete positions in 3D space. Example: point3rotation({0,0,0},{100,100,100},{100,0,-100})The rotation vector that this returns is: {-120,-35.26,45}.This rotation vector is derived by the axes (vector2-vector1) to spin the axes correctly on the third position vector (vector3).
ADD ROTATION Description
Purpose Adds two rotations. Vector1 and vector2 are vectors that represent discrete XYZ rotations.
Syntax addrotation(vector1,vector2)
ANGLE DIFF POINTS Description
Purpose Calculates the angle between two vectors or points, using a supplied radius.
Syntax anglediffpoints
ANGLE DIFF ROTATIONS Description
Purpose Calculates the difference between the rotation of two objects. The result can be scaled and offset.
Syntax anglediffrotations (R1, R2)
ANGULAR ACCELERATION Description
Returns The angular acceleration of a rotation vector.
Syntax angularacc(vector) Vector is a vector that represents an XYZ rotation.
ANGULAR SPEED Description
Returns The angular speed of a rotation vector.
Syntax angularspeed(vector)Vector is a vector that represents an XYZ rotation.
DERIVATIVE Description
Returns The derivative of a vector by time.
Syntax derivative(vector)
GLOBAL TO LOCAL Description
Purpose Converts a rotation vector from global to local coordinates.
Syntax globaltolocal (rotation)Vector is a vector that represents a position or a speed in 3D space.
GRAVITY MOVE Description
Returns A position.
Syntax gravitymove(vector1, vector2, vector3)Vector1 is a vector that represents an initial position in 3D space.Vector2 is a vector that represents an initial speed. Vector3 is a vector that represents the acceleration that you want to give to your current position.
INTERPOLATE ROTATION Description
Purpose Interpolates between two rotations.
Syntax interpolaterotation(R1, R2)
LOCAL TO GLOBAL Description
Purpose Converts a rotation vector from local to global coordinates.
Syntax localtoglobal(Rotation)
MOVE Description
Returns A position.
Syntax move(vector1, vector2, vector3) Vector1 is a vector that represents an initial position in 3D space.Vector2 is a vector that represents an initial speed. Vector3 is a vector that represents the acceleration that you want to give to your current position.
ORBIT Description
Returns A position. Number is a real number that represents the acceleration constant (MorimobjG6.673E-11) between the origin and the current position (G = 6,672e-11 N m2/kg2).
Syntax orbit(vector1, vector2, vector3, number) Vector1 is a vector that represents an initial origin position in 3D space (attractive point). Vector2 is a vector that represents the initial object position in 3D space. Vector3 is a vector that represents an initial speed of your object position.
POSITION DAMPING Description
Returns A position.Number1 is a number that represents the maximum speed. Number2 is a number that represents the maximum acceleration. Number3 is a number that represents the damping ratio. (Includes Play Mode in-connector.)
Syntax positiondamping(vector1, number1, number2, number3)Vector1 is a position vector in 3D space.
ROTATION DAMPING Description
Returns An XYZ rotation. Vector1 is an XYZ rotation vector. Number1 is a number that represents the maximum angular speed.Number2 is a number that represents the maximum angular acceleration. Number3 is a number that represents the damping ratio. (Includes Play Mode in-connector.)
Syntax rotationdamping(vector1, number1, number2, number3)
ROTATION PRODUCT Description
Returns The rotation vector multiplied by a ratio number. Number is a real number that represents a multiplication ratio.
Syntax multrotation(vector,number)Vector is a vector that represents an XYZ rotation.
SENSOR ROTATION HELPER Description
Syntax sensorrotationhelper
SUB ROTATION Description
Purpose Substitutes two rotations.
Syntax subrotation(vector1,vector2)Vector1 and vector2 are vectors that represent discrete XYZ rotations.
SPEED Description
Returns The speed of a position vector.
Syntax speed(vector)Vector is a vector that represents a position in 3D space.

Source functions

The following expressions are source functions:

HALF CIRCLE RAMP Description
Syntax ramphalfcircle(Amplitude, Frequency, Phase)(Includes a Play Mode in-connector.)
ISOCELES TRIANGLE RAMP Description
Syntax ramptriiso(Amplitude, Frequency, Phase)(Includes a Play Mode in-connector.)
PLAY PAUSE COUNTER Description
Purpose Lets you create a counter.
Syntax playpausecounter
RANDOM Description
Purpose Creates a stream of random numbers at a specified frequency.
Syntax random
RIGHT TRIANGLE RAMP Description
Syntax ramptrirec(Amplitude, Frequency, Phase)(Includes a Play Mode in-connector.)
SINE RAMP Description
Syntax rampsine(Amplitude, Frequency, Phase)(Includes a Play Mode in-connector.)
SQUARE RAMP Description
Syntax rampsquare(Amplitude, Frequency, Phase)(Includes a Play Mode in-connector.)
START STOP COUNTER Description
Purpose Lets you create a counter.
Syntax startstopcounter

Time functions

The following expressions concern time functions:

TIMETOSECONDS Description
Purpose Converts time to a number of seconds.
Syntax timetosecond(number)Number is the time code that you want to convert to seconds.

Vector expressions

The following are vector expressions:

ACCELERATION Description
Purpose Returns the acceleration of a position vector.
Syntax acceleration(vector)Vector is a vector that represents a position in 3D space.
ANGLE Description
Purpose Finds the angle between the arguments.
Syntax angle(vector1,vector2)Vector1 is a vector. Vector2 is a vector.
DETERMINANT VECTOR Description
Returns The determinant of a 3x3 column (I,J,K) matrix.
Syntax determinantvec
DOT PRODUCT Description
Purpose Scalar product of the arguments. Returns the scalar product of vector1 and vector2.
Syntax vector1^vector2
SCALE DAMPING Description
Returns Damping to a scaling vector. (Includes a Play Mode in-connector.)
Syntax scaledamping
SCALE OFFSET VECTOR Description
Purpose Scales and offsets a vector.
Syntax scaleoffsetvec
* (NUMBER*VECTOR) Description
Purpose Scales a vector.
* (VECTOR*NUMBER) Description
Purpose Scales a vector.