- Home /
Animation not Playing
Hello! I have a pair of animated hands. When I'm touching water than the swimming animation plays normaly but when I want to swim faster (I have an other aimation) the animation is not playing! Hereis my script:
if(controller.velocity.magnitude > 0 && GetComponent(Swimming).swim == true){
animation.Play("Swimming");
if(Input.GetKey(KeyCode.LeftShift))
animation.Play("FastSwimming");
Also I have an other script for the speed change:
if(swim == true)
speed = swimSpeed;
if(Input.GetKey(KeyCode.LeftShift))
speed = fastSwimSpeed;
Is there a mistake? Please help me! :)
if(Input.GetButton("FastSwim$$anonymous$$g"))
animation.Play("FastSwim$$anonymous$$g");
else
animation.Play("Swim$$anonymous$$g");
You could try that, and set FastSwim$$anonymous$$g to left shift in the input options
Otherwise
if(Input.GetButtonDown("FastSwim$$anonymous$$g"))
animation.Play("FastSwim$$anonymous$$g");
else if(Input.GetButtonUp("FastSwim$$anonymous$$g"))
animation.Play("Swim$$anonymous$$g");
The first one works (I didnt tried the second, but looks the same thing!). However I don't understand why this one works and the one I had before didnt! Could you please explain it to me! :)
Answer by archiefied1 · Oct 31, 2014 at 05:43 AM
well im not familiar with the animation.play mechanics but try this
if(controller.velocity.magnitude > 0 && GetComponent(Swimming).swim == true){
animation.Play("Swimming");
if(Input.GetKey(KeyCode.LeftShift))
{
animation.Stop("Swimming");
animation.Play("FastSwimming");
}
}
Again not familiar with it.
It's not working. It just plays the animation for fast swim$$anonymous$$g when I stop pressing to move forward!