When I apply an upwards linear impulse to a ball that is falling through the air, it shoots straight downwards to the ground. The impulse works fine when the ball is on the ground, and when I press the jump button it bounces nicely, but if the ball is in the air it shoots downwards. How can I make it so the jump button doesnt work when the ball is in the air? [import]uid: 116264 topic_id: 20727 reply_id: 320727[/import]
I would use a flag (a boolean property on the Ball object, “isGrounded” for example).
You would set Ball.isGrounded by checking the collision between the Ball and the Floor objects.
Logic only, not Lua :
If Collision between Ball and Floor then Ball.isGrounded = true;
if Jumpbutton is pushed and Ball.isGrounded == true, then jump.
(else, do nothing).
[import]uid: 95346 topic_id: 20727 reply_id: 81432[/import]
Thanks I’ve done what you suggested and it worked [import]uid: 116264 topic_id: 20727 reply_id: 81582[/import]