Hello
i need help. i am making a spaceship which moves in mouse's direction (and rotates also).
it is possible to make it move perpendicular to the direction of mouse?
tvz wrote:it is possible to make it move perpendicular to the direction of mouse?
char* key = GetKeyState();
double ang = direction(xscreen, yscreen, xmouse, ymouse); // this gets the angle towards the mouse
// your rotation code would go here using ang
angle = ang + (key[KEY_RIGHT] - key[KEY_LEFT])*90; // plus or minus 90 of the direction to the mouse to make it perpendicular
directional_velocity = (key[KEY_RIGHT] || key[KEY_LEFT]) * 5; // 5 being the speed you want it to move
Users browsing this forum: Google [Bot] and 1 guest