if(wIsPressed){
movement.x += sin((player.getRotation() * 3.141592654)/ 180) * .5; //accelerates ship at a rate of 0.5 ms^2
movement.y -= cos((player.getRotation() * 3.141592654)/ 180) * .5; //accelerates ship at a rate of 0.5 ms^2
}
else if(abs(movement.x) > 0 || abs(movement.y) > 0){
double angle = (atan2(movement.x, movement.y) * 3.141592654) / 180; //finds angle of current movement vector and converts fro radians to degrees
movement.x -= sin((angle)) * 0.5; //slows down ship by 0.5 using current vector angle
movement.y += cos((angle)) * 0.5; //slows down ship by 0.5 using current vector angle
}
basically, what happens after using this code is that my ship is pulled directly down to the bottom of the screen, and acts like the ground has gravity, and i dont understand what i am doing incorrectly
To elaborate on my comment:
You're not converting your angle to degrees properly. It should be:
However, you're using this angle in another trig calculation, and the C++ trig functions expect radians, so you really shouldn't be converting this to degrees in the first place. Your else if statement could also be causing problems, because you're checking for an absolute value greater than 0. Try something like this: