Okay so I have a game that the player(space ship) is trying to go around a planet, but if it gets to close the player's space ship is turned to the planet.
So I am trying to use:
float dx = [_player position].x - [planetNodes[i] position].x;
float dy = [_player position].y - [planetNodes[i] position].y;
double angleToTurn = (180.0 / M_PI) * atan2(dy, dx);
NSLog(@"Turn to: %f", angleToTurn);
_player.zRotation = angleToTurn;
This code is put in the update method of the scene. Whenever the player gets too close to the planet it begins spinning because I am using the rotate method. Is there a method like setAngle? That way whenever the update is called it will reset the angle and actually look like the player is moving towards the planet.