Make a physics object not jump in the air

Hi, I have a problem that has been stumping me for weeks and is a HUGE problem!

Basically my game is a physics game in which the main character and the level are all physics objects.
My problem is that I when i jump and then press the jump button while I’m in the air, my main character immediately shoots down to the ground. What I need is for the object to only be able to jump if it is in contact with the ground…Or not be able to jump when it is in the air (depending how you think about it)

Any help is much appreciated!

Thanks! [import]uid: 66317 topic_id: 35406 reply_id: 335406[/import]

robo, something like this may work…

check your player.y value and then 50 miliseconds later, check it again and if the y values are == then allow the player to jump. If the y values are the same, it verifies the player is not jumping or floating down (eliminates double jump).

Hope this helps,

Nail [import]uid: 106779 topic_id: 35406 reply_id: 140706[/import]

I used multi-body physics and gave my player “feet”. I then only allowed the jump to be activated again once the “feet” had made contact with the ground again.

I’m sure there are a lot of ways to skin this one, but that’s my two cents. :slight_smile: [import]uid: 21331 topic_id: 35406 reply_id: 140712[/import]

robo, something like this may work…

check your player.y value and then 50 miliseconds later, check it again and if the y values are == then allow the player to jump. If the y values are the same, it verifies the player is not jumping or floating down (eliminates double jump).

Hope this helps,

Nail [import]uid: 106779 topic_id: 35406 reply_id: 140706[/import]

I used multi-body physics and gave my player “feet”. I then only allowed the jump to be activated again once the “feet” had made contact with the ground again.

I’m sure there are a lot of ways to skin this one, but that’s my two cents. :slight_smile: [import]uid: 21331 topic_id: 35406 reply_id: 140712[/import]