Inconsistent behavior between AnimationMixer.stopAllActions() and AnimationAction.stop()
See original GitHub issueHi,
While trying to get my animations to work as I wanted, I noticed some inconsistent behavior between AnimationMixer.stopAllActions()
and AnimationAction.stop()
.
What I was doing basically comes down to the following (assuming two AnimationActions
A and B):
- Make my model visible.
- Fade in A
- After some time, cross-fade to B
- After some more time “stop all animations” and hide the model.
- At some later point in time, start again at 1. This is where the difference comes into play
Initially I just called stopAllActions()
for “stop all animations” (Version 1 in the JSFiddle). But then I had the problem at step 5, that the fading in A again, started the fade in from the last pose that the model was in at step 4. So after stopAllActions()
the model somehow seems to retained its last pose.
But if I instead call stop()
on all AnimationAction
s (instead of just calling stopAllActions()
), then the models starts fading in from the default pose (Versions 2/3 in the JSFiddle). (Which in my situation was what I wanted).
After some investigation I found out that if stopAllActions()
doesn’t cause restoreOriginalState()
to be called on the bindings. While it does when using stop()
.
I’m not sure what the exact expected behavior should be, but I would guess the stop()
behavior.
Change between VERSION 1, 2 & 3 in this JSFiddle to see the difference in behavior.
Note: If you would call stopAllActions()
the first time and then for later “loops” use the stop()
approach, then it will keep behaving as if stopAllActions()
was called. I.e. it seems that the “original state” was updated to the last pose, and no longer is the default pose. But I didn’t investigate this any further though.
Three.js version
- Dev
- r116
- …
Browser
- All of them (Probably, only tested Chrome and Firefox)
- Chrome
- Firefox
- Internet Explorer
OS
- All of them (Probably, only tested Windows and Android)
- Windows
- macOS
- Linux
- Android
- iOS
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (4 by maintainers)
Top GitHub Comments
I’ll see what I can do for the unit test. I’ll have to figure out how to do them (properly (for animations)). So it might take a couple of days. Anyway, thank you for accepting the pull request for the issue.
@Mugen87 I’m sorry, but I do think the reverse loop is needed. See this JSFiddle