User Guide
538
• #animationStarted and #animationEnded are notification events that occur when a bones or
keyframe animation starts or stops playing. The handler will receive three arguments:
eventName, motion, and time. The eventName argument is either #animationStarted or
#animationEnded. The motion argument is the name of the motion that has started or stopped
playing, and
time argument is the current time of the motion.
For looping animations, the
#animationStarted event is issued only for the first loop, not
for subsequent loops. During a blend of two animations, this event will be sent as the
blend begins.
When a series of animations is queued for the model and the animation’s
autoBlend property is
set to TRUE, the #animationEnded event may occur before the apparent end of a given motion.
This is because the
autoBlend property may make the motion appear to continue even though
the animation has completed as defined.
• #timeMS is a time event. The first #timeMS event occurs when the number of milliseconds
specified in the
begin parameter have elapsed after registerForEvent is called. The period
parameter determines the number of milliseconds between #timeMS events when the value of
repetitions is greater then 0. If repetitions is 0, the #timeMS event occurs indefinitely.
The handler you specify is sent the following arguments:
type is always 0.
delta is the elapsed time in milliseconds since the last #timeMS event.
time is the number of milliseconds since the first #timeMS event. For example, if there are three
iterations with a period of 500 ms, the first iteration’s time will be 0, the second iteration will
be 500, and the third will be 1000.
duration is the total number of milliseconds that will elapse between the registerForEvent call
and the last
#timeMS event. For example, if there are five iterations with a period of 500 ms, the
duration is 2500 ms. For tasks with unlimited iterations, the duration is 0.
systemTime is the absolute time in milliseconds since the Director movie started.
Examples
This statement registers the messageReceived event handler found in a movie script to be called
when the model named Player receives the custom user defined event named
#message:
member("Scene").model("Player").registerScript(#message, \
#messageReceived, 0)
This statement registers the collisionResponder event handler found in the same script as the
registerScript command to be called each time a collision occurs between the model named
Player and any other model using the
#collision modifier:
member("Scene").model("Player").registerScript(#collideWith, \
#collisionResponder, me)
See also
registerForEvent(), sendEvent, setCollisionCallback(), collisionData