- Home /
Animation Only Plays Once in third person controller
I am using the mecanim animation system, and I've set the parameter 'VSpeed' to equal Vertical axis, so the walk animation is played when Vspeed=1 and idle when Vspeed=0. It works, but the walk animation only plays once, then the character keeps zooming forward. Also, the character floats in the air, even though it has a character controller which presumably gives it gravity. Here's the script:
public class ControlScript : MonoBehaviour {
private Animator theanimator;
// Use this for initialization
void Start () {
theanimator=GetComponent<Animator>();
}
// Update is called once per frame
void Update () {
float vVal = Input.GetAxis ("Vertical");
theanimator.SetFloat ("VSpeed", Input.GetAxis ("Vertical"));
if (vVal == 1) {
transform.Translate (0, 0, 2);
}
}
}
What's wrong? Also, is there a more efficient way of making a third-person controller? Any help would be appreciated
Your answer
Follow this Question
Related Questions
ThirdPersonController Script doesn't use animations on model imported from Blender 1 Answer
Is there a way to edit the default 3rd person controller to do extra animations? 0 Answers
Changing default animation of AI third person controller to walk? 0 Answers
Can the animation editor create local rotational data? 3 Answers
Adding animation clips via script 2 Answers