xiphiaz

How to dynamically change the animation speed without it skipping forward/back in time [Solved]

Recommended Posts

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

Share this post


Link to post
Share on other sites
13 minutes ago, Deltakosh said:

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 ???

 

Share this post


Link to post
Share on other sites

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 ???

Share this post


Link to post
Share on other sites
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 :)

 

Share this post


Link to post
Share on other sites
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 :)

 

Share this post


Link to post
Share on other sites
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 :))

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 :)

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.