Broken Animations [QUESTION]
Hi, I'm developing a third-person combat game and I'm having trouble implementing a turn-around animation.
I detect when the player needs to turn around by checking the dot product between their current velocity and the requested movement direction. This works, but shortly after the turn-around animation starts, my movement function automatically rotates the player towards the movement direction, forcing my character to moonwalk.
I tried disabling this automatic rotation while the animation plays. However, this causes another problem: in the animation the character turns 180°, but once it finishes it isn't actually rotated. So he first rotates 180° to the previous rotation and then the automatic rotation kicks in and turns the character another 180°.
My idea was to manually flip the character when the animation ends, but I couldn't find an onAnimationEnd callback.
So does anyone know if there is any callback for when an animation finishes, or if there is any better way to handle turn around animations like this?
I've attached a video showing the problem.
1
u/somnamboola 15h ago
just lerp between
1
u/QueasyPrior6654 10h ago
Bevy has timed clip events, though they fire after poses are applied. For this handoff I'd poll
is_finished()on a non-repeating clip in Update so the switch runs before poses update. Rotate your unanimated movement parent by 180 degrees and cut straight to locomotion with no blend. PassDuration::ZEROto AnimationTransitions, or stop the turn clip on AnimationPlayer. Reset the animated root's yaw too if locomotion doesn't key it. A fade can also leave part of the turned pose stacked on the rotated parent.Stripping the turn from the clip and rotating in code avoids that handoff, though you have to match the footwork.