What I would like to achieve is a character to jump, only being able to press the space bar once to jump, and only being able to use it once untill the jump is over. Now, the problem:
With my charachter, you can hold down spacebar and he just keeps on rising. I have no idea how to fix this. Anybody got any ideas?
The best way is to use states. The moment the player pushes space, you apply an upwards force and change their state. In the new “jumping” state, you do not look for the space bar, only if the ground is underneath them, upon which you revert to the normal first state.
make the jump (a strong upward “force” not “loc”) dependent on 2 sensor: spacebar and a short -Z oriented ray, connect them using an “and” controler. If you do that the character will only jump when you press spacebar AND when there is something under his feet.
This might not work the first time: you have to tweak the ray length and the upward force strength depending on the object mass