Here’s the custom controller script:
CharacterController controller = GetComponent<CharacterController> ();
if (controller.isGrounded) {
moveDirection = new Vector3 (Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical"));
moveDirection = transform.TransformDirection (moveDirection);
moveDirection *= speed;
if (Input.GetKeyDown ("space") && blockOn == false)
moveDirection.y = jumpSpeed;
anim.SetBool ("Jump", true);
JumpOn = true;
}
moveDirection.y -= gravity * Time.deltaTime;
controller.Move (moveDirection * Time.deltaTime);
So when i walk downhill,it jump on/off and my walk anim glitches. What code do i insert to avoid this problem? Thx in advance.