Fixes AnimationGroup isPlaying when mask is applied & played more than once #15862
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A followup fix of #15836 and forum issue:
https://forum.babylonjs.com/t/animationgroup-isplaying-is-always-true-if-animationgroupmask-is-applied/54799
When
AnimationGroupMask
is applied,isPlaying
will set tofalse
on the first time, which works as expected.However if the animation group is played more than once,
isPlaying
will still betrue
after the animation has ended (can be reproduced on the playground provided in the forum issue).It is due to
AnimationGroup._animatables.length
being assumed to be 0 when the animation has ended.So explicitly clear
AnimationGroup._animatables
should finally fix the issue.