• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Physics Bug - Impulse/Jump angle on curved objects

K

Kano_Stuff

Guest
Hi everyone !

I'm new to gml and GMS 2 and i have a weird bug with physics.
(I'm sorry, english isn't my native language, i hope you'll understand me)

twitter.com/kano_stuff/status/869202284118499328
(Inside the link there's is a gif of this bug)

Code:
//Jump script (BUTTON A)
if (gamepad_button_check_pressed(0,gp_face1)) && place_meeting(x,y,collider_obj) {
physics_apply_impulse(phy_position_x,0,0,player_jump);
}
I made a while ago a prototype of this game on Construct 2 and the "script" was something like :
Impulse towards position (x,y,impulse) -> (player.x, 0, impulse)

Whatever the player's angle/the ground's angle, the jump was nice and towards the top of the room.

I tried to code something like this but it's not working :/

Can anyone help me ?
 

Jezla

Member
physics_apply_local_impulse(0, 0, 0, player_jump);

That should apply the impulse vertically to the instance. Be aware when applying forces and impulses how the parameters relate to the object origin to calculate the correct vectors. The manual explains the specifics for each function.
 
Top