In the video below you can see that when I go on the bridge I have a glitch. My guess is that somehow in that glitch the player is trying to fall here is the code:
if(isGrounded){
if(Input.GetKey(KeyCode.LeftShift)){
speed = runSpeed;
} else if(Input.GetKey(KeyCode.C)){
speed = croutchSpeed;
anim.SetFloat("InputMagnitude",1);
} else {
speed = walkSpeed;
anim.SetFloat("InputMagnitude",0);
}
float direction = Input.GetAxis("Horizontal") * speed;
Vector3 movement = new Vector3(direction*Time.deltaTime,0,0);
player.Translate(movement);
if(movement.magnitude > 0)
playerModel.rotation = Quaternion.LookRotation(movement);
anim.SetFloat("InputX", direction);
} else {
anim.SetFloat("InputX",0);
anim.SetFloat("InputMagnitude",4);
}
Thank you!