T
TpTheGreat
Guest
Hi,
I'm new here =)
This looks like a great community!!
I have a question regarding this:
"physics_apply_local_impulse(0, 0, 0, -5 );"
The Scenario
i have the player object sitting on the ground, when hitting "Space" i run this command to jump using "physics_apply_local_impulse(0, 0, 0, -5 );".
I want the player to be able to also jump in mid air (like a double jump), and i want the second jump to make the player jump the same height\distance as the one from the ground.
so if from the ground the jump is 10cm, doesn't matter when i click the jump again, even in mid air, i want to player to jump 10cm more from the current position in mid air.
The problem:
when clicking the Jump key again while in mid air, if the player is on the way down from the previous jump, then it jumps (goes up) only 1-2 cm and then keeps falling, probably because of the initial force applied to the player by the gravity while it is falling.
I read that impulse does NOT take into consideration the current object movement, and should ignore it and act the same if the object is not moving.
What am I missing?
Do I need to, before running the impulse command - somehow stop the object and mid air and have the impulse then apply on the "stationary mid air object? if yes, how?
Thanks in advance!
I'm new here =)
This looks like a great community!!
I have a question regarding this:
"physics_apply_local_impulse(0, 0, 0, -5 );"
The Scenario
i have the player object sitting on the ground, when hitting "Space" i run this command to jump using "physics_apply_local_impulse(0, 0, 0, -5 );".
I want the player to be able to also jump in mid air (like a double jump), and i want the second jump to make the player jump the same height\distance as the one from the ground.
so if from the ground the jump is 10cm, doesn't matter when i click the jump again, even in mid air, i want to player to jump 10cm more from the current position in mid air.
The problem:
when clicking the Jump key again while in mid air, if the player is on the way down from the previous jump, then it jumps (goes up) only 1-2 cm and then keeps falling, probably because of the initial force applied to the player by the gravity while it is falling.
I read that impulse does NOT take into consideration the current object movement, and should ignore it and act the same if the object is not moving.
What am I missing?
Do I need to, before running the impulse command - somehow stop the object and mid air and have the impulse then apply on the "stationary mid air object? if yes, how?
Thanks in advance!
Last edited by a moderator: