• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!

GMS 2 Need help with a physics based cannon game

I want to make a game where a physics object is launched from a cannon at different speed and powers, the problem is getting the object to launch out at the angle of the cannon but the function physics_apply_impulse() is based on having an x force and a y force not a power and an angle... so my question is is there any way to translate an angle to the the 2 forces?


Friendly Tyrant
Forum Staff
Use the lengthdir_x/y functions to get the x/y vectors for the impulse functions. Just give the launch angle as the direction and the force for the length. :)

PS: you may need to offset the direction by 90º as the physics directions have 0º at the top, not to the right, IIRC.