I’ve got a problem with my jump & movement script. Whenever I hit the spacebar my figure doesn’t jump properly. It never hits the ground and just “flies” in the air. Does somebody know what I am doing wrong? Any answers appreciated!
true in every frame if you hold the button pressed during that frame, and
false only when you don’t hold the button down.
Assuming you have your project running at 100-200 frames per second, your code adds jump force to the rigid body multiple times even if you just hit the Space quickly. It might trigger 4 times, 10 times, 50 times in a row, depending on how long the button has been down and how fast the game is rendered.
What to do: use
Input.GetKeyUp() for non-continious actions.
true only once in the one frame within which the button has been pressed down, and then it will be
false until you press it down again.
true only at the moment when the button has been released.