Capture event: trigger function when animation has finished playing

manproof

New member
This has already been posted in the Director forum, but I haven't heard anything, so...

I have a 3D cast member that contains a bunch of animations defined by start and end points. For example, from 200 to 5000 milliseconds is a rotation animation, and between 5001 and 6000 is a translation animation. I need to know when each of these animations have finished. I used animationEnded initially, but I am not sure how to set animationEnded to fire after a defined span of animation has terminated.

Do I need to write a custom event to capture this? If so, how do you define an event? I am looking at using registerForEvent, I just don’t know how to write the event itself.

Any help is appreciated.
 
Haven't gotten any responses either here or in the Director forum.

Instead of trying to write a custom event, I am just looping a check to see if the playList of the cast member equals 0. This seems to work, as once the animation span has finished, the animation is dumped from the playlist.

This is less elegant than firing a single event when the animation is done, but it seems to work. If anyone out there knows how to write a custom event in Director I'd still like to hear from you.
 
You can use the animationended event together with a form of play or queue to get what you need

for you example something like

--register function to listen for animation events
3dworld.registerForEvent(#animationended, #myCustomerFunction, me )

--either play events one at a time
3dworld.model("mdlToPlay").keyframePlayer.play("motion1", 0, 200, 5000)


--or try and queue them up (this sometimes causes issue

3dworld.model("mdlToPlay").keyframePlayer.queue("motion1",0, 200, 5000 )
3dworld.model("mdlToPlay").keyframePlayer.queue("motion2",0, 5001,8000 )

if you use queue turn off autoBlend as you're in the same animation sequence
 
Back
Top