9

148 Chapter 4: Obj ect Properties
Parentheses are a special case. They are a grouping
or subexpression operator that is provided so you
can override the precedence order of the other
operators.
Variables
In expressions you write for expression controllers
(page 2–320), variables are represented by
symbolic names. You c reate them to contain
constant or variable values in your expressions.
Several predefined variables are also provided.
Some of these have a constant value, others can
vary.
In expressions used for parameter wiring (page
2–411) and the numerical expression evaluator
(page 1–13), you can use predefined variables with
constan t values.
Predefined Variables with Constant Values
Thesearethepredefinedvariablesthathavea
constant value (variable names are case-sensitive):
Variable
Name
Constant
Value
Use
pi
3.14159
Ratio of a circle’s
circumference to its diameter.
e
2.71828
Base of natural logarithms.
TPS
4800
Ticks per second. The tick is
the basic time unit of 3ds Max
animation.
Predefined Variables with Variable Values
Thesearethepredefinedvariablesthathavea
variable, time-based value (variable names are
case-sensitive).
Variable
Name
Meaning
F
Frame number. For each frame, F equals the
current frame number, counting from zero.
The range of frames can vary depending
on the number of frames in the active time
segment.
Variable
Name
Meaning
NT
Normalized time. By de finition, normalized
time (NT) ranges from 0 to 1 over the active
time segm ent, regardless of how many
frames are in the segment. If you base
an expression on NT, its effect happens
exactly once over the range. You can also
multiply NT by a fac tor for the expression’s
effect to occur a certain number of times
(for example, 2*NT causes the expression’s
effect to occur twice). Expressions bas ed
on NT speed up or slow down if you change
the leng th of the time segment.
S
Seconds (elapsed time in seconds). Elapsed
time is measured from the first frame to the
current f rame. The range of seconds can
vary depending on the total time of the
active time segm ent.
T
Ticks ( elapsed time in ticks). There are 4800
ticks p er second. Elapsed time is measured
from the first frame to the current frame.
The range of ticks can vary depending on
thetotaltimeoftheactivetimesegment.
Rules for Variable Names
Variable names can contain as many
alphanumeric characters as you like. Their
length is not limited.
Variable names cannot contain spaces.
The variable name must begin with a letter.
Numbers are valid within a vari able name (as
in "Pos1" or "M23").
Variable names are case-sensitive. For example,
"pos", "Pos", and "POS" desig nate three
different variables.
•Youcantcreateavariablewithanamethat
duplicates another name, including the variable
names that are predefined.
Funct ions
Following is a list of the functions provided for
expressions. In this list, p, q, and r represent scalar
values or scalar expressions. V and W represent
vector values or vector expressions.