Trigger 2D Animation once

Hi there,

i got a little issue which bothers me:

In my infinite runner game, I want the character to play a short animation if he hits an obstacle before continuing his run animation. The animation shall play only once for each hit. I tried an animationtrigger which is set as soon the collision is detected but that doesn’t really work as I want it to, sometimes it just keeps playing the animation until I jump or die, but overrides the run animation :confused:

Any idea how to fix this?

sure, here it is:

I want the animation to play also if the player hits an obstacle during a jump, so that’s why I thought it might be good to have a transition from any state…

Please use comment, and not the Answer form ! :slight_smile:

I see that you don’t have transition to CK_run apart from Any State → Jump → CK_run, why don’t you try to add a transition from any state to CK_run with a proper condition ?
As you said: “sometimes it just keeps playing the animation until I jump or die” that is because to transistion to CK_run you must first pass from Jump as it is the only node that transitions to CK_run.

Let me know !