When I use syncAllAnimationsWith to synchronize the animation, i find the animation looks incoherent. I don’t know if it’s a bug or I’m using it wrong.
As you can see PG , when press the run
or walk
button, the animation look incoherent. if remove syncAllAnimationsWith, everything looks perfect except out of sync.
It can be found from the source code that syncWith places the current animable after syncRoot, which I think may be the reason for the incoherent animation. but I’m not sure how to resolve it to make the animtion switch coherently when I use syncAllAnimationsWith.
Welcome aboard!
The animations look ok to me in the PG, the transition between walk / run or run / walk is smooth.
What do you call “incoherent”? Can you show a video of what you see?
@Evgeni_Popov Hi, Thank you for your reply. the video is here, maybe my description is not very clear.
What I want to say is that when switching animations, the arm suddenly thrown from front to back. Just like the two animations without useing
enableBlending .
Unfortunately, it’s not possible to have smooth blending and synchronization at the same time.
The call to animGroup.syncAllAnimationsWith(animatable)
has been added to synchronize animations, but you may have a jump in animation just after this call because the frame calculated by animGroup
just before the call to syncAllAnimationsWith
may be different from the frame calculated just after the call, because the new frame will be calculated on the basis of animatable
’s frame range + current frame. In general, these two calculations won’t give the same result (unless you’re lucky and call syncAllAnimationsWith
at the right time!).
I don’t think there’s anything we can do to solve this problem. To improve the existing result, I think some people/games use specific transition animations to switch from walking to running, or any other pair of animations.
cc @PatrickRyan to be sure I don’t miss anything.
Note: for my tests, I used a simplified PG that makes use of some new features added in the latest Playground update (notably the AnimationGroup.weight
property):
1 Like
Note that you can use blending instead of weighting:
Personally, I think the result is better this way.
@Koko_Rice, I would say that @Evgeni_Popov is right in that with our current animation system using enableBlending
with a quick blend speed is probably the best outcome. As for transition animations, many experiences will use them, but not in every case.
If you have a character running one direction and then need to make a cut to run in another direction, an animation showing the body arresting motion in one direction to shift weight and transition to another direction looks more realistic. But it also takes time and can make a character feel less responsive. Forgoing that transition animation makes the character feel more responsive because the change is immediate but can leave the character feeling like they have no weight or introduce sliding where the feet make contact with the ground. Usually, the path chosen is somewhere in the middle. Transition animations for some types of motion and not for others.
Animation state machines are very helpful for this type of animation pathing. Basically, every state knows where it is allowed to path and which animations to sequence to get there. Unfortunately, we don’t have a helper for animation state machines in Babylon, but I have seen people integrate something like XState in the past to help manage animations.
1 Like
@Evgeni_Popov @PatrickRyan Thank you both for your replies and suggestions. Instead of animation weight, I decided to use enableBlending to switch between running and walking.
1 Like
Note that using the global scene.animationPropertiesOverride
object is not ideal, but now that this PR is merged, you can do:
1 Like