I am trying to do a game that has physics and you play with a character that needs to push and avoid getting killed by physics objects. Character is controlled by buttons that will apply some physic forces to left or right, or up (jump)
The problems:
How do I detect when the character is again back on ground after jump, so i can prevent him jumping (flying) with the physics before he is back?
I need something like "if character is colliding with another physics object, enable jump, else disable it".
And then: "if character is moving after jump to direction y at any speed, enable double jump. else disable it."
Now i have done it with timer. Character can jump only once / 1 second, but its not best solution to this. And because every force has an equal opposite force, i made it like when player clicks jump button, my character first does physics force 300 to angle 90, then waits 0,1 second and does physics force 300 to angle -90. This works very well, except when he is in air when player clicks the jump button. Then the character fast moves down, that is not good thing.
I hope someone understood what i am trying to do.