Chapter 19
482
Models
Models can be referred to by name or number. Models can be added to or removed from the
world at any time.
In the member’s parent-child hierarchy, each model must have one parent, but it can have an
unlimited number of children. A child’s position and orientation depend on its parent’s position
and orientation, and it changes when the position and orientation of the parent changes. Models
that don’t have another model and a parent have the group named world as their parent. In this
case, their
transform
property describes their position and rotation in the 3D world, and is
identical to their
getWorldTransform()
property. All models that have models as parents have a
relationship both to their immediate parent and to the world parent. You can add or remove
models from the 3D world at any time by using the
addToWorld()
or
removeFromWorld()
commands.
For example, if the first child of the model named
car1
is a wheel model, the following
transform
Lingo would refer to the position of the wheel relative to the model named
car1
:
car1.child(1).transform.position
To refer to the position of the wheel model relative to the world itself, use
getWorldTransform()
:
car1.child(1).getWorldTransform().position
Node types
A model is one of four types of objects that share the same transform, parent, and child
properties. The others are cameras, lights, and groups. Models, cameras, lights, and groups are
generically referred to as node types or nodes. Nodes can be each other’s parents or children, so long
as any one node has exactly one parent. A node can have any number of children. A model, for
example, can be the child of a light and the parent of a group.
cloneMotion
FromCastMember
(
name
,
motion
,
castmember
)
Performs a deep clone of a motion from one cast member
and puts it into another cast member.
A motion object
newModel
Resource(
name,
type)
Creates a new model resource and adds it to the model
resource palette. The
type
can be
#plane
,
#box
,
#sphere
,
#cylinder
, or
#particle
.
The
type
cannot be
#mesh
. To create a new mesh model
resource, use the
newMesh
command detailed below.
New model resource
object
newMesh(
name,
numFaces,
numVertices,
numNormals
numColors,
numTexture
Coordinates
)
Creates a new mesh model resource.
numFaces
is the user-specified number of triangles.
numVertices
is the user-specified number of vertices. A
vertex can be used by more than one face.
numNormals
is the user-specified number of normals.
Enter
0
or omit this step to use the
generateNormals()
method.
numColors
is the user-specified number of colors. You
can specify a color for each point of a triangle.
numTextureCoordinates
is the number of user-
specified texture coordinates. Enter
0
or omit this step to
get the default coordinates.
New mesh model
resource
Command
Description
Returns
Содержание DIRECTOR MX-USING DIRECTOR MX
Страница 1: ...Using Director MX Macromedia Director MX...
Страница 12: ...Contents 12...
Страница 156: ...Chapter 4 156...
Страница 202: ...Chapter 6 202...
Страница 244: ...Chapter 7 244...
Страница 292: ...Chapter 10 292...
Страница 330: ...Chapter 12 330...
Страница 356: ...Chapter 13 356...
Страница 372: ...Chapter 14 372...
Страница 442: ...Chapter 16 442...
Страница 472: ...Chapter 18 472...
Страница 520: ...Chapter 19 520...
Страница 536: ...Chapter 20 536...
Страница 562: ...Chapter 23 562...
Страница 566: ...Chapter 24 566...
Страница 602: ...Chapter 27 602...