Angles suck! Well no they don’t.. it’s just my coding skills that suck 😀
I’ve been messing about with angles today trying to get one game object (the enemy) to turn and face another game object (the player). Using atan2 this works perfectly but the enemy faces the player immediately. I want the enemy to turn slowly towards the player and then stop turning when it is directly facing the player. This seems to be rather difficult and is doing my head in 😦
I have calculated the angle that the enemy needs to be pointing to directly face the player, the direction (clockwise or counterclockwise) that the enemy should turn in order to face the player, and the number of degrees that the enemy needs to turn in either direction.
What I can’t figure out is all that stupid crap that needs to happen when the enemy rotates about the 360/0 point of a circle. I’m sure there is some easy math solution but it eludes me and google is being most unhelpful. Oh well, tomorrow is another day 😉
I’ll be scraping peeling paint off the bathroom in the flat tomorrow though and then washing the ceiling down with vinegar to kill the mold.. a nasty job for sure.