FunFetched Posted July 5, 2017 Share Posted July 5, 2017 Found an issue with Animation/AnimationEvent where an event set for an earlier frame is immediately triggered when playing the animation starting at a later frame. Here's a playground example of the problem (you'll need to open your JS console): https://www.babylonjs-playground.com/#E54IFV#4 Edit: Taking a look at the code, I can already see the problem. I'll see if I can't whip this one myself. Quote Link to comment Share on other sites More sharing options...
FunFetched Posted July 5, 2017 Author Share Posted July 5, 2017 Oof. This is also affecting animations that are played backwards. On line 656 in babylon.animation.ts we have this line: if (currentFrame >= this._events[index].frame) { Obviously, currentFrame is floating point, so we can't just do a simple == in this situation. Unfortunately, since it's looping through all of the events from start to finish every time, all previous events in the timeline get triggered right off the bat, even if we started the animation at a later point. In the case of backwards animations, the problem is exacerbated for the same reason. If we only supported forward animation, the solution would be a simple matter of changing the line above to: if (currentFrame >= this._events[index].frame && this._events[index].frame >= from) { ... but I guess it's not that simple any more. I'll keep digging. Quote Link to comment Share on other sites More sharing options...
FunFetched Posted July 5, 2017 Author Share Posted July 5, 2017 Fixed it here, and posted a pull request. https://github.com/BabylonJS/Babylon.js/pull/2440 Temechon 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 6, 2017 Share Posted July 6, 2017 And merged thanks a lot! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.