472
Chapter 12: Methods
The above is equivalent to:
member("scene").model("bip01").rotate(20,20,20).
Generally
preRotate()
is only useful when dealing with transform variables. This line will orbit
the camera about the point (100, 0, 0) in space, around the y axis, by 180°.
t = transform()
t.position = member("scene").camera[1].transform.position
t.preRotate(vector(100, 0, 0), vector(0, 1, 0), 180)
member("scene").camera[1].transform = t
See also
rotate
preScale()
Usage
transformReference
.preScale(
xScale
,
yScale
,
zScale
)
transformReference
.preScale(
vector
)
member(
whichCastmember
).
node
.transform.preScale(
xScale
, \
yScale
,
zScale
)
member(
whichCastmember
).
node
.transform.preScale(
vector
)
Description
3D transform command; applies a scale prior to the existing positional, rotational, and scaling
effects of the given transform.
Node
may be a reference to a model, group, light, or camera.
Parameters
xScale
Required if applying a scale using
x
-,
y
-, and
z
-axes. Specifies the scale around the
x
-axis.
yScale
Required if applying a scale using
x
-,
y
-, and
z
-axes. Specifies the scale around the
y
-axis.
zScale
Required if applying a scale using
x
-,
y
-, and
z
-axes. Specifies the scale around the
z
-axis.
vector
Required if applying a scale using a vector. Specifies the vector that contains the scale
to apply.
Example
Line 1
of the following Lingo creates a duplicate of Moon1’s transform. Remember that access to
a model’s transform property is by reference.
Line 2
applies a scale to that transform prior to any existing positional or rotational effects of that
transform. Assume that the transform represents the positional offset and rotational orbit of
Moon1 relative to its parent planet. Lets also assume Moon2’s parent is the same as Moon1’s. If
we used
scale()
here instead of
preScale()
, then Moon2 would be pushed out twice as far and
rotated about the planet twice as much as is Moon1. This is because the scaling would be applied
to the transform’s existing positional and rotational offsets. Using
preScale()
will apply the size
change without affecting these existing positional and rotational offsets.
Line 3
applies an additional 180° rotation about the
x
-axis of the planet. This will put Moon2 on
the opposite side of Moon1’s orbit. Using
preRotate()
would have left Moon2 in the same place
as Moon1, spun around its own
x
-axis by 180°.
Summary of Contents for DIRECTOR MX 2004
Page 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Page 48: ...48 Chapter 2 Director Scripting Essentials...
Page 100: ...100 Chapter 4 Debugging Scripts in Director...
Page 118: ...118 Chapter 5 Director Core Objects...
Page 594: ...594 Chapter 12 Methods...
Page 684: ...684 Chapter 14 Properties See also DVD...
Page 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Page 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Page 1102: ...1102 Chapter 14 Properties...