xiphiaz Posted September 12, 2017 Share Posted September 12, 2017 Hello, I'm having a bit of trouble working out how I can dynamically change the animation speed, while still maintaining the current frame the animation is up to when I make the change. See demo here http://www.babylonjs-playground.com/#IBU2W7#2 When the speed changes I would hope that the current frame was not affected, so I can ramp down to a period of slow motion then resume back to normal speed I suspect I might be mutating the wrong variable to change the speed, but I can't work out what might fix it Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted September 12, 2017 Share Posted September 12, 2017 That is an interesting question, indeed. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 13, 2017 Share Posted September 13, 2017 How about this: https://www.babylonjs-playground.com/#IBU2W7#3 Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted September 13, 2017 Share Posted September 13, 2017 13 minutes ago, Deltakosh said: How about this: https://www.babylonjs-playground.com/#IBU2W7#3 Hey @Deltakosh I was looking for something like this as well... My question is...since the property is called: scene.animationTimeScale, does that mean it increase the speed of ALL animations currently playing, not just the one I am interested in speed up.... Basically I need to be able to adjust the speed of the animation to match my movement speed so I don't get AS MUCH foot sliding... OR is there some already documented way of handing match the speed od movement to the speed of the animation ??? Quote Link to comment Share on other sites More sharing options...
adam Posted September 13, 2017 Share Posted September 13, 2017 I solved this issue in a PG last year. Never added it to BJS though. Edit: Darn, it's at scene level. Quote Link to comment Share on other sites More sharing options...
adam Posted September 13, 2017 Share Posted September 13, 2017 It looks like it did get added to BJS: https://github.com/BabylonJS/Babylon.js/blob/master/src/babylon.scene.ts#L1854 Sorry it doesn't solve your issue. Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted September 13, 2017 Share Posted September 13, 2017 Hey @adam how it going Yeah I saw that tooo.. but looks like its at the scene level... Do you know what this it meant to do: var delay = this._animationTime; for (var index = 0; index < this._activeAnimatables.length; index++) { this._activeAnimatables[index]._animate(delay); } Does that look like some kinda of '_animate()' function that take a delay... What that all about ??? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 13, 2017 Share Posted September 13, 2017 delay is a terribly named variable to identify the deltatime This is something we could also add at animatable level. adam 1 Quote Link to comment Share on other sites More sharing options...
xiphiaz Posted September 14, 2017 Author Share Posted September 14, 2017 @Deltakosh great that works well (also works to make all animations reverse), however is it possible to control a single animation? I think this actually suits my needs, but it would be good to know if independent control is possible Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted September 14, 2017 Share Posted September 14, 2017 7 hours ago, xiphiaz said: @Deltakosh great that works well (also works to make all animations reverse), however is it possible to control a single animation? I think this actually suits my needs, but it would be good to know if independent control is possible Yo @xiphiaz ... What works Well??? Are you looking at an example the changes the animation speed ??? Is it the scene level or an individual animation ??? I could NOT tell from the answers above if we DO or DO NOT support scaling animation on the actual animatables (not the whole scene level).. I mean the example above ALSO directly uses: this._activeAnimatables[index]._animate(delay); First that looks PRIVATE... should we be messing with that directly??? And is 'DELAY' the actual Speed Ratio or What??? Can you show me please Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted September 14, 2017 Share Posted September 14, 2017 16 hours ago, Deltakosh said: delay is a terribly named variable to identify the deltatime This is something we could also add at animatable level. Yo @Deltakosh Do you think you can make an OFFICIAL version that scales at the animation level as well...??? Siley Face As Always Quote Link to comment Share on other sites More sharing options...
xiphiaz Posted September 14, 2017 Author Share Posted September 14, 2017 @MackeyK24 the example that @Deltakosh gave which uses `scene.animationTimeScale` works for my purposes. I would however prefer to be able to do animation level scaling as it affects other things like camera animations which I don't really want. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 14, 2017 Share Posted September 14, 2017 @xiphiaz : I'm just unsure why speedRatio is not enough in your case Quote Link to comment Share on other sites More sharing options...
xiphiaz Posted September 14, 2017 Author Share Posted September 14, 2017 @Deltakosh Yea I would have thought that was the right parameter, but as you can see in my original demo (http://www.babylonjs-playground.com/#IBU2W7#2) modifying the speed ratio on the fly causes the animation to glitch back and forth in the animation timeline. Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted September 14, 2017 Share Posted September 14, 2017 1 minute ago, Deltakosh said: @xiphiaz : I'm just unsure why speedRatio is not enough in your case Yo @Deltakosh Can you use speedRatio to update the speed of the currently LOOPING animation ??? I am really just looking for a way to match my animation speed up with my movement speed (BTW... Root Motion Solves All This... If you ever got a chance to look at the video I made for you about root motion... maybe you can help me get that feature working ) Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted September 14, 2017 Share Posted September 14, 2017 10 minutes ago, xiphiaz said: @MackeyK24 the example that @Deltakosh gave which uses `scene.animationTimeScale` works for my purposes. I would however prefer to be able to do animation level scaling as it affects other things like camera animations which I don't really want. I thinks thats EXACTLY what I need as well ... Let me know if you find out or get this working. I am still trying to get 'Root Motion' going which solves all my character animation movement problems as the animation root position magnitude drives the actual character at the proper animation speed... Don't have to modify animation on the fly because the stick value move the guy slightly faster BEFORE it reaches the threshold to play the next animation... YOU GET MAJOR FOOT SLIDE. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 14, 2017 Share Posted September 14, 2017 Ok the speedRatio change was kind of a bug, now it works better: https://www.babylonjs-playground.com/#GT5VF1 The fix was deployed to github as well. Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted September 14, 2017 Share Posted September 14, 2017 14 minutes ago, Deltakosh said: Ok the speedRatio change was kind of a bug, now it works better: https://www.babylonjs-playground.com/#GT5VF1 The fix was deployed to github as well. Sweet... So we can just use animatable.speedRatio DURING an already playing animation... Sweet... And can use scene.animationTimeScale for OVERALL animation speed control for the entire the scene ... Thanks @Deltakosh ... I will wait for next preview release distilled and update the toolkit from then Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 14, 2017 Share Posted September 14, 2017 it is already in the preview release Quote Link to comment Share on other sites More sharing options...
xiphiaz Posted September 21, 2017 Author Share Posted September 21, 2017 @Deltakosh fix looks good is it in the latest npm release? (`[email protected]`) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 21, 2017 Share Posted September 21, 2017 It will today (alpha3) 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.