Reading up on this thread. Also trying to attach an AnimationEvent to a frame number. For example: : At frame number 1.3, console.log(āhello world.ā).
Feel like Iāve been through every conceivable combination of object and array in the console, but no luck being able to attach an event to anything. Finally found an object that would accept addEvent without erroring out⦠but doesnāt seem to do anything. How the heck do you grab a handler to an animation group? Seems like itās all there in inspector⦠but canāt figure out how to grab it.
Not 100% sure ā maybe the proās know more about that ā But I think glTF and glbās donāt work with frames anymore but with actual time. Thatās why framesPerSecond is 1 in your file but your animation plays fluidly.
Ohmygosh. I was so focused on finding the path to animation that i didnāt notice that param! Thank you thank you!
Yes, strange about FPS. Also the structure of the exported GLB seems kind of a mess. Thereās a couple replicated skeletons within armatures, all those keyframes, and an extraneous camera/light. I figure its related to my convoluted pipeline (FBX->Mixamo->GLB->Blender->GLB). But Iām not complaining, b/c with this frame event, everything in my game is now working! Awesome.
Hi Sir, I completely understand all the above answers. But I have a question here:
How can I attach an AnimationEvent to animation if the animation is LOOPING
I expect I can console.log message every time the animation arrives at that progress point when looping.
I expect it console.log(āYeah!ā) every at 10% progress when looping
Currently it just console.log once
Thanks in advance for any hint to solve the problem!
Thanks, Deltakosh! I keep on finding these bits of wisdom tucked away in old posts. . I was perplexed that I couldnāt get an event to trigger until I saw your post and placed the animation after the event-setting.
Itās been a few months since you posted (so you probably resolved this already), but I thought Iād try to make Events repeat during the āDudeāsā looped walk cycle. Itās a pretty rough and messy attempt, so the Events go out of sync after a whileābut they do repeat! The basic idea behind it is to use an event (event3, in this case) at the end of each walk cycle that restarts the animation. I used two versions of the same walk cycle and the switching of a number variable to try to alleviate the events-going-out-of-sync problem, but it didnāt work. Anyway, hereās a PG, for what itās worth:
Edit: the lights dimming and brightening (the events I used) went out of sync in exactly the same way no matter how I revised the codeāand they repeatedly got back in sync again for a short while, which makes me wonder if the problem is due to lag caused by the light increasing in intensity? Maybe itās slower than the dimming of the light? Not sure if that makes logical senseā¦
Hello! Instead of attaching the events to the bones, the way I would do it is by creating a ādummyā animation to handle events, and adding everything to an AnimationGroup. This way, I wouldnāt have to worry about choosing a bone to add an animation to, or anything else, and it loops nicely this way: AnimationEvent and skeleton animation | Babylon.js Playground (babylonjs.com).