This question already has an answer here:
I'm creating some robots for my tank game. I want them to find each other and shoot each other down, so I'm trying to implement a way for them to turn towards each other, and turn the shortest way. For instance, if we where T1 (tank 1), how could I figure out if I where to turn right of left, and at what angle to turn if
- Tank1 (us) position is (8906,76), facing is 23 degrees.
- Tank2 (enemy) position is (888,61)
0/360 is straight up.
The way I've tried to do is to decide what quadrant the enemy is of myself. But that leaves out a 45 degree angle to fail. I know there is some archtan but I cant simply get a grip on them...