This section lists the Expressions supported by MotionBuilder. Each is shown with an example that you can use as a guide when building your own Expressions.
Converters
The following expressions can be used as Converters:
HSB TO RGB |
|
Converts |
HSB to RGB mode. |
Syntax |
HSB2RGB |
NUMBER TO COLOR ALPHA |
|
Converts |
Four numbers into a color vector. |
Syntax |
number2coloralpha |
NUMBER TO VECTOR |
|
Converts |
A number to a vector. |
Syntax |
num2vec |
RGB TO RGBA |
|
Converts |
RGB to RGBA mode. |
Syntax |
RGB2RGBA |
RGB TO HSB |
|
Converts |
RGB to HSB mode. |
Syntax |
RGB2HSB |
RGBA TO RGB |
|
Converts |
RGBA mode to RGB. |
Syntax |
RGBA2RGB |
SECONDS TO TIME |
|
Converts |
A number of seconds to a time format. |
Syntax |
seconds2time |
TIME TO SECONDS |
|
Converts |
A time format to a number of seconds. Use the time2seconds expression to convert time to a number of seconds in an Expressions
constraint.
|
Syntax |
time2seconds |
Logical functions (Boolean)
The following are expressions of logical functions:
AND |
|
Returns |
TRUE if all its arguments are TRUE. |
Syntax |
and(number1, number2) Number1 and number2 should be logical values. |
EQUAL |
|
Returns |
TRUE if its arguments are EQUAL. |
Syntax |
number1 = number2 (number, number) Number1 and number2 are the numbers that you want to test. |
GREATER |
|
Returns |
TRUE if the first argument is greater than the second argument. |
Syntax |
number1 >= number2 (number, number)Number1 and number2 are the numbers that you want to test. |
GREATER OR EQUAL |
|
Returns |
TRUE if the first argument is greater than or equal to the second argument. |
Syntax |
number1 >= number2 (number, number)Number1 and number2 are the numbers that you want to test. |
IF |
|
Specifies |
A logical test to perform) |
Syntax |
if (test, value1, value2)Test is any value or expression that can be evaluated to TRUE or FALSE. Value1 is the value that
is returned if test is TRUE.Value2 is the value that is returned if test is FALSE.
|
IS BETWEEN |
|
Checks |
Checks if one value is between two others) |
Syntax |
isbetween |
LESS |
|
Returns |
TRUE if the first argument is less than the second argument) |
Syntax |
number1 < number2 (number, number) Number1 and number2 are the numbers that you want to test. |
LESS OR EQUAL |
|
Returns |
TRUE if the first argument is less than or equal to the second argument. |
Syntax |
number1 <= number2 (number, number)Number1 and number2 are the numbers that you want to test. |
NAND |
|
Returns |
FALSE if all its arguments are TRUE. |
Syntax |
nand(number1, number2)Number1 and number2 should be logical values. |
NOR |
|
Returns |
FALSE if any argument is TRUE. |
Syntax |
nor(number1, number2)Number1 and number2 should be logical values. |
NOT |
|
Purpose |
Reverses the logic of its argument. |
Syntax |
not(number) Number is a value or expression that can be evaluated to TRUE or FALSE. If number is FALSE, NOT returns TRUE.if
number is TRUE, NOT returns FALSE.
|
NOT EQUAL |
|
Returns |
TRUE if its arguments are NOT EQUAL. |
Syntax |
number1 <> number 2 (number 1, number 2)Number1 and number2 are the numbers that you want to test. |
OR |
|
Returns |
TRUE if any argument is TRUE. |
Syntax |
or(number1, number2)Number1 and number2 should be logical values. |
Mathematical expressions
The following are mathematical expressions:
DISTANCE |
|
Purpose |
Finds the distance between two vectors. |
Syntax |
distance(vector1, vector2)Point1 and point2 should be two positions in 3D space. |
DISTANCE NUMBERS |
|
Sends |
The distance between the two numbers. |
Syntax |
SetDistanceNumbers |
GO TO BEGIN |
|
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 |
|
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 |
|
Purpose |
When triggered (the value is changed from 0 to 1), the Transport Controls move to a specified position. |
Syntax |
GotoPosition (cell) |
LENGTH |
|
Purpose |
Finds the length of a vector. |
Syntax |
length(vector) |
MIDDLE POINT |
|
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 |
|
Returns |
The normalized vector. Vector is the vector you want to normalize. |
Syntax |
norm(vector) |
PLAY MODE |
|
Purpose |
Changes the value of the playback mode. |
Syntax |
SetPlayMode |
PLAY BACKWARD MODE |
|
Purpose |
Changes the value of the playback mode. |
Syntax |
SetPlayBackwardMode |
POW |
|
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 |
|
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 |
|
Purpose |
Number2 is the number by which you want to divide number1. |
Syntax |
number1 / number2 |
RECORD MODE |
|
Purpose |
Changes the value of the Record mode. |
Syntax |
SetRecordMode |
STEP FORWARD |
|
Syntax |
StepForward (cell)When triggered (the value is changed from 0 to 1), the Transport Controls move one step forward. |
STEP BACKWARD |
|
Purpose |
When triggered (the value is changed from 0 to 1), the Transport Controls move one step backward. |
Syntax |
StepBackward |
SUM |
|
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 |
|
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 |
|
Returns |
The absolute value of a number or cell. |
Syntax |
abs(number) |
ACOS |
|
Returns |
The arccosine of a number. Number is the cosine of the angle you want. |
Syntax |
acos(number) |
ASIN |
|
Returns |
The arcsine of a number. Number is the sine of the angle you want. |
Syntax |
asin(number) |
ATAN |
|
Returns |
The arctangent of a number. Number is the tangent of the angle you want. |
Syntax |
atan(number) |
ATAN2 |
|
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 |
|
Returns |
The cosine of a number. Angle is the angle in radians for which you want the cosine. |
Syntax |
cos(angle) |
DEG2RAD |
|
Converts |
Degrees to radians. Angle is the angle in degrees that you want to convert. |
Syntax |
deg2rad(angle) |
EXP |
|
Purpose |
Number is the exponent applied to the base value e. |
Syntax |
exp(number) |
INTEGER |
|
Purpose |
Rounds numerical values down to the next full digit. |
Syntax |
integer |
LN |
|
Returns |
The natural logarithm of a number. Number is the positive real number for which you want the natural logarithm. |
Syntax |
ln(number) |
LOG |
|
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 |
|
Returns |
The result of 1/number. Number is the positive real number for which you want 1/number. |
Syntax |
oneover(number) |
PULL NUMBER |
|
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 |
|
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 |
|
Purpose |
Converts radians to degrees. Angle is the angle (in radians) that you want to convert. |
Syntax |
rad2deg(angle) |
SIN |
|
Returns |
The sine of the given angle. Angle is the angle in radians for which you want the sine. |
Syntax |
sin(angle) |
SQRT |
|
Returns |
A positive square root. Number is the number for which you want the square root. |
Syntax |
sqrt(number) |
TAN |
|
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 |
|
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 |
|
Purpose |
Applies damping to a numerical value. |
Syntax |
damping(number) |
DAMP (Clock based) |
|
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) |
|
Purpose |
Similar to Damp (clock-based), except this expression is based on the Damp (3D) relation. |
Syntax |
damp3dclockbased |
DAMPING (3D) |
|
Purpose |
Damps the position of a vector using a specified damping factor. |
Syntax |
damping3d |
PRECISION VECTOR |
|
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 |
|
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 |
|
Purpose |
Sends an alternating stream of zeroes and ones at the specified frequency, for example: 010101010101. |
Syntax |
pulse |
TRIGGERED PLUS MINUS COUNTER |
|
Purpose |
Creates a trigger to add the increment/decrement. |
Syntax |
triggeredplusminuscounter |
TRIGGERED RANDOM |
|
Purpose |
Generates a random number on demand. |
Syntax |
triggeredrandom |
Rotation expressions
The following expressions are used for rotation functions:
3 POINTS ROTATION |
|
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 |
|
Purpose |
Adds two rotations. Vector1 and vector2 are vectors that represent discrete XYZ rotations. |
Syntax |
addrotation(vector1,vector2) |
ANGLE DIFF POINTS |
|
Purpose |
Calculates the angle between two vectors or points, using a supplied radius. |
Syntax |
anglediffpoints |
ANGLE DIFF ROTATIONS |
|
Purpose |
Calculates the difference between the rotation of two objects. The result can be scaled and offset. |
Syntax |
anglediffrotations (R1, R2) |
ANGULAR ACCELERATION |
|
Returns |
The angular acceleration of a rotation vector. |
Syntax |
angularacc(vector) Vector is a vector that represents an XYZ rotation. |
ANGULAR SPEED |
|
Returns |
The angular speed of a rotation vector. |
Syntax |
angularspeed(vector)Vector is a vector that represents an XYZ rotation. |
DERIVATIVE |
|
Returns |
The derivative of a vector by time. |
Syntax |
derivative(vector) |
GLOBAL TO LOCAL |
|
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 |
|
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 |
|
Purpose |
Interpolates between two rotations. |
Syntax |
interpolaterotation(R1, R2) |
LOCAL TO GLOBAL |
|
Purpose |
Converts a rotation vector from local to global coordinates. |
Syntax |
localtoglobal(Rotation) |
MOVE |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
Syntax |
sensorrotationhelper |
SUB ROTATION |
|
Purpose |
Substitutes two rotations. |
Syntax |
subrotation(vector1,vector2)Vector1 and vector2 are vectors that represent discrete XYZ rotations. |
SPEED |
|
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 |
|
Syntax |
ramphalfcircle(Amplitude, Frequency, Phase)(Includes a Play Mode in-connector.) |
ISOCELES TRIANGLE RAMP |
|
Syntax |
ramptriiso(Amplitude, Frequency, Phase)(Includes a Play Mode in-connector.) |
PLAY PAUSE COUNTER |
|
Purpose |
Lets you create a counter. |
Syntax |
playpausecounter |
RANDOM |
|
Purpose |
Creates a stream of random numbers at a specified frequency. |
Syntax |
random |
RIGHT TRIANGLE RAMP |
|
Syntax |
ramptrirec(Amplitude, Frequency, Phase)(Includes a Play Mode in-connector.) |
SINE RAMP |
|
Syntax |
rampsine(Amplitude, Frequency, Phase)(Includes a Play Mode in-connector.) |
SQUARE RAMP |
|
Syntax |
rampsquare(Amplitude, Frequency, Phase)(Includes a Play Mode in-connector.) |
START STOP COUNTER |
|
Purpose |
Lets you create a counter. |
Syntax |
startstopcounter |
Time functions
The following expressions concern time functions:
TIMETOSECONDS |
|
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 |
|
Purpose |
Returns the acceleration of a position vector. |
Syntax |
acceleration(vector)Vector is a vector that represents a position in 3D space. |
ANGLE |
|
Purpose |
Finds the angle between the arguments. |
Syntax |
angle(vector1,vector2)Vector1 is a vector. Vector2 is a vector. |
DETERMINANT VECTOR |
|
Returns |
The determinant of a 3x3 column (I,J,K) matrix. |
Syntax |
determinantvec |
DOT PRODUCT |
|
Purpose |
Scalar product of the arguments. Returns the scalar product of vector1 and vector2. |
Syntax |
vector1^vector2 |
SCALE DAMPING |
|
Returns |
Damping to a scaling vector. (Includes a Play Mode in-connector.) |
Syntax |
scaledamping |
SCALE OFFSET VECTOR |
|
Purpose |
Scales and offsets a vector. |
Syntax |
scaleoffsetvec |
* (NUMBER*VECTOR) |
|
Purpose |
Scales a vector. |
* (VECTOR*NUMBER) |
|
Purpose |
Scales a vector. |