I want my character to jump when I press the space bar but not to keep going up if I keep holding it. I want to use rigidbody but not character controller. Here is my code:
if (Input.GetKey("space")) {
animator.SetBool("Jumping", true );
rigidbody.AddForce(0,100,0);
}else{
animator.SetBool("Jumping", false );
}
PS I have tried GetKeyDown but then my character doesn’t go up at all.