User Guide
278
The transform property of a node is calculated relative to the transform of the node’s parent, and
is therefore parent-relative. The
getWorldTransform() command calculates the node’s transform
relative to the origin of the 3D world, and is therefore world-relative.
Use
member(whichCastmember).node(whichNode).getWorldTransform().
position
to find the position property of the node’s world-relative transform. You can also use
worldPosition as a shortcut for getWorldTransform().position.
Use
member(whichCastmember).node(whichNode).getWorldTransform().
rotation
to find the rotation property of the node’s world-relative transform.
Use
member(whichCastmember).node(whichNode).getWorldTransform().
scale
to find the scale property of the node’s world-relative transform.
These properties can be tested but not set.
Example
This statement shows the world-relative transform of the model named Box, followed by its
position and rotation properties:
put member("3d world").model("Box").getworldTransform()
-- transform(1.000000,0.000000,0.000000,0.000000, \
0.000000,1.000000,0.000000,0.000000, \
0.000000,0.000000,1.000000,0.000000, - \
94.144844,119.012825,0.000000,1.000000)
put member("3d world").model("Box"). getworldTransform().position
-- vector(-94.1448, 119.0128, 0.0000)
put member("3d world").model("Box"). getworldTransform().rotation
--vector(0.0000, 0.0000, 0.0000)
See also
worldPosition, transform (property)
global
Syntax
global variable1 {, variable2} {, variable3}...
Description
Keyword; defines a variable as a global variable so that other handlers or movies can share it.
Every handler that examines or changes the content of a global variable must use the
global
keyword to identify the variable as global. Otherwise, the handler treats the variable as a local
variable, even if it is declared to be global in another handler.
Note: To ensure that global variables are available throughout a movie, declare and initialize them in the
prepareMovie handler. Then, if you leave and return to the movie from another movie, your global variables will be
reset to the initial values unless you first check to see that they aren’t already set.
A global variable can be declared in any handler or script. Its value can be used by any other
handlers or scripts that also declare the variable as global. If the script changes the variable’s value,
the new value is available to every other handler that treats the variable as global.
A global variable is available in any script or movie, regardless of where it is first declared; it is not
automatically cleared when you navigate to another frame, movie, or window.
Any variables manipulated in the Message window are automatically global, even though they are
not explicitly declared as such.