
Vector math
397
Vector math
A 3D vector describes both direction and location in 3D space. Vector objects include floating-
point values for position along each of the
x-
,
y-
, and
z
-axes. Vectors can be node-relative or
world-relative. If they are node-relative, their
x
,
y
, and
z
values are relative to the position of the
node. If they are world-relative, their
x
,
y
, and
z
directions are relative to the world.
Vector math operations perform calculations using each of the
x
,
y
, and
z
values. These
calculations are useful for performing intelligent movement and rotation of models.
Vector creation methods
Use these methods to create vectors:
Vector properties
Use these properties to work with vectors:
Method
Description
Returns
vector
(x,y,z)
Creates a vector from arguments representing all axes.
A vector object
random
Vector()
Creates a vector describing a randomly chosen point on
the surface of a unit sphere. Differs from
vector(random(10)/10.0
,
random(10)/10.0
,
random(10)/
10.0)
because the
randomVector()
method always
results in a unit vector.
A unit vector
Property
Access
Description
magnitude
Get
The magnitude of the vector. Equivalent to the length of
the vector.
length
Get
The length of the vector. Equivalent to the magnitude of
the vector.
[
index
]
Get and set
Returns the value of a vector at a specified point in an
index between 1 and 3.
x
Get and set
The
x
component of a vector.
y
Get and set
The
y
component of a vector.
z
Get and set
The
z
component of a vector.
Summary of Contents for DIRECTOR MX 2004-USING DIRECTOR
Page 1: ...DIRECTOR MX 2004 Using Director...
Page 16: ...16 Chapter 1 Introduction...
Page 82: ...82 Chapter 3 Sprites...
Page 98: ...98 Chapter 4 Animation...
Page 134: ...134 Chapter 5 Bitmaps...
Page 242: ...242 Chapter 10 Sound and Synchronization...
Page 274: ...274 Chapter 11 Using Digital Video...
Page 290: ...290 Chapter 12 Behaviors...
Page 302: ...302 Chapter 13 Navigation and User Interaction...
Page 334: ...334 Chapter 15 The 3D Cast Member 3D Text and 3D Behaviors...
Page 392: ...392 Chapter 16 Working with Models and Model Resources...
Page 418: ...418 Chapter 18 Movies in a Window...
Page 446: ...446 Chapter 22 Managing and Testing Director Projects...