Physics double jump issue.

sercan

Member
Hi,
I have an object that jumps with mouse click. I want to use physics world to do this. when the object is on the ground with applying impulse it is ok, it works. But I want to jump again when the object is still on the air. The problem is the second jumping level is not same as the first. Because the forces on the object are different from the initial values. Sometimes it jumps higher and some times it is like a brake. Physically this is normal. But want the object to jump same with every click.
For example what if i want to make flappy bird using physics? İ know physics is not required for it but i need to know.
Thanks
 

sercan

Member
Instead of an impulse change the phy_speed_y variable
Thank you. Works good.

Another problem.
In a physics room, I do not want my object effected from any forces but gravity. Is it possible?
For example i want to to hit a ball and see the ball reacts according to physical rules. but i want my object to keep steady on its way.
 

Tornado

Member
What about giving it much bigger mass?
Try to set its density to a high value. Then the objects with much less mass won't be able to "move" it.

If it doesn't help 100%, then additionally check restitution value in the fixture of the player object. It is a value between 0 and 1.
0 means no bouncing, 1 means a lot of bouncing.
 
Last edited:
P

Pain9971

Guest
Hi sercan,

the easiest method to solve your problem is to set:
phy_linear_velocity_y = 0;
phy_linear_velocity_y += jumpPower;

With this way everytime you press your jump key the jumpspeed should be equal!!

Hope it works

kind regards
 

sercan

Member
Hi sercan,

the easiest method to solve your problem is to set:
phy_linear_velocity_y = 0;
phy_linear_velocity_y += jumpPower;

With this way everytime you press your jump key the jumpspeed should be equal!!

Hope it works

kind regards
Thank you for reply mate.
I have solved that using this. Close to yours.

if keyboard_check_pressed ( vk_up )
{
phy_speed_y=-6;
}

gravity of the room is set to " 60 " on the y axis.
 

sercan

Member
What about giving it much bigger mass?
Try to set its density to a high value. Then the objects with much less mass won't be able to "move" it.

If it doesn't help 100%, then additionally check restitution value in the fixture of the player object. It is a value between 0 and 1.
0 means no bouncing, 1 means a lot of bouncing.
I tried that but it didn't work. It is almost immovable but not perfect. Still does a bit. I need something to fix the x position of the player.
 
Top