
394
Chapter 17: Controlling the 3D World
Use these methods to set up event handling:
Collisions
By attaching the collision modifier (
#collision
) to a model, you can enable that model to
automatically respond to collisions with other models. By using the properties of the collision
modifier, you can control the details of how the model responds to collisions. For more
information about collisions, see
“Modifiers” on page 366
.
Collision properties
When a collision occurs, it generates a
collideAny
event or a
collideWith
event.The
collideWith
event passes an argument to the handler that is declared with the
registerForEvent
,
registerScript
, or
setCollisionCallBack
method. This argument is
called a
collisionData
object and contains a property list with detailed information about
the collision.
Method
Description
Returns
registerForEvent
(
eventName
,
handlerName
,
scriptInstance
,
model
)
The event
eventName
is one of the following:
#collideAny
: Called when any collision occurs.
#collideWith
: Called when a collision with a specific
model occurs and implicitly registered when
setCollisionCallback(...)
is called. Equivalent to
calling
model.collision.setCollision
Callback
.
#timeMS
: Sets up a time-based simulation callback
using the format
registerForEvent
(timeMS,
handlerName
,
scriptInstance
)
begin
,
period
,
repetitions
.
The
begin
and
period
arguments are in
milliseconds. If
repetitions
is set to
0
, the simulation
continues indefinitely.
#animationStarted
: Called whenever a keyFrame or
bones motion begins.
#animationEnded
: Called whenever a keyFrame or
bones motion ends.
Any user-defined symbol: Registers to receive any
user-defined event sent from a SendEvent call.
TRUE (1)
if the
operation succeeds.
FALSE (0)
if the
operation fails.
unregister
AllEvents()_
Unregisters all events.
Nothing.
A script error is
generated if the
operation fails.
sendEvent
(
eventName
,
arg1
,
arg2...
)
Sends an event named
eventName
to all scripts
registered to receive it.
Similar to
sendAllSprites()
except that the event is
delivered only to scripts that are registered to receive
it.
Nothing.
A script error is
generated if the
operation fails.
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...