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.


2 thoughts on “Angles

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s