- Home /
Animtion looping if joystick is held
Hi There, I hope someone can help me here.
I am triggering animations with joystick input, but if I hold the joystick (UP) the animation keeps looping.
How can I reset the animation until I push the joystick (UP) again?
void Update()
{
if (joystick1.Vertical >= 0.8f)
{
anim.Play("Shove");
}
add a boolean "verticalPressed" to the check, that you set to true along with Play and reset if Vertical is below 0.8f
Hi @hexagonius, Thank you for your response!
$$anonymous$$uch appreciated, the thing is I am a C# and program$$anonymous$$g beginner so I don't know how to implement your fix. Could you please show me how it looks?
Thanks again
Create a boolean: public bool verticalPressed = false;
Now
void Update()
if(verticalPressed == true) { anim.Play("Shove") }
if (joystick1.Vertical >= 0.8f)
{
verticalPressed = true;
}
Hope it helped!
Your answer
Follow this Question
Related Questions
Animate an Object by letting it play out in when I press play? 0 Answers
Change Idle/Walk player animation permanently on trigger colliders 1 Answer
Error with my strafe animations on player 0 Answers
how to make multiple transition from one state? 1 Answer
Blending animations for a bow with differing charges 1 Answer