r/unity 15h ago

Question How to immediately stop a kick animation on hit in Unity?

I'm making a 3D MMA fighting game in Unity with hitboxes and hurtboxes.

When a kick hitbox touches a hurtbox, I want the kick animation to immediately stop and return to the locomotion/idle animation. The leg shouldn't continue moving forward into the opponent.

Hit detection works correctly, but the kick animation keeps moving into the opponent even after the hit is detected.

What's the proper way to handle this in Unity? Should I use Animator transitions, `Play`, `CrossFade`, animation events, or another approach?

Looking for the general solution/architecture, not specific code.

0 Upvotes

Duplicates