D
Dr Nitronio
Guest
So I'm trying to create something simple using the physics engine.
I want any physics object (like a ball, square, triangle, players, etc) to stay on the platform and move with it when the platform itself moves vertically, horizontally, or diagonally. Anytime I move the platform itself, the object will stay on top somewhat, but won't move with the platform correctly. Here's what it looks like.
Moving sideways, down, and diagonally doesn't work well. The platform will be able to tilt too so we have to make sure it works with that too.
Here is what I have to control the platform in the step event if this helps. Am I going at this wrong or am I missing code?
hspd += stick_h_hold*acceleration;
hspd = clamp(hspd, -move_speed, move_speed)
if stick_h_hold = 0 {hspd = lerp(hspd, 0, .25);}
vspd += stick_v_hold*acceleration;
vspd = clamp(vspd, -move_speed, move_speed)
if stick_v_hold = 0 {vspd = lerp(vspd, 0, .25);}
phy_position_x += hspd;
phy_position_y += vspd;
if button_a = 1 {phy_rotation -= 5;}
if button_b = 1 {phy_rotation += 5;}
I want any physics object (like a ball, square, triangle, players, etc) to stay on the platform and move with it when the platform itself moves vertically, horizontally, or diagonally. Anytime I move the platform itself, the object will stay on top somewhat, but won't move with the platform correctly. Here's what it looks like.
Moving sideways, down, and diagonally doesn't work well. The platform will be able to tilt too so we have to make sure it works with that too.
Here is what I have to control the platform in the step event if this helps. Am I going at this wrong or am I missing code?
hspd += stick_h_hold*acceleration;
hspd = clamp(hspd, -move_speed, move_speed)
if stick_h_hold = 0 {hspd = lerp(hspd, 0, .25);}
vspd += stick_v_hold*acceleration;
vspd = clamp(vspd, -move_speed, move_speed)
if stick_v_hold = 0 {vspd = lerp(vspd, 0, .25);}
phy_position_x += hspd;
phy_position_y += vspd;
if button_a = 1 {phy_rotation -= 5;}
if button_b = 1 {phy_rotation += 5;}
Last edited by a moderator: