A
Algae12185
Guest
I am making controls by clicking the object, and releasing the mouse elsewhere to move the object in that direction. Everything works fine when I have phy_fixed_rotation = true, but as soon as I add rotation it throws everything WAY off. I understand that with rotation it will throw it off some, but it seems seriously off. What can I do (other than have no rotation) to remove or reduce how much rotation affects the controls?
Code:
//Left Mouse Press
pressx = mouse_x
pressy = mouse_y
//Left Mouse Global Release
xforce = lengthdir_x(point_distance(pressx,pressy,mouse_x,mouse_y),
point_direction(pressx,pressy,mouse_x,mouse_y))*2
yforce = lengthdir_y(point_distance(pressx,pressy,mouse_x,mouse_y),
point_direction(pressx,pressy,mouse_x,mouse_y))*2
if pressx != 0 & pressy != 0
{
physics_apply_local_force(0,0,xforce,yforce)
}
pressx = 0
pressy = 0