I’ve been trying to calculate the angle between two Vec2’s, but for some reason the way i’ve learned to do it via trig isn’t working, and instead is giving me completely incorrect angles (in radians, and between 0 and 2π, which is kinda good at least because that’s the expected range, but the angle itself is seemingly placebo-random within that range). This is the method i’m using (please excuse the awful writing):
Anyone know why the heck this isn’t working? I’ve tried this with Atan and Atan2, but neither works
This is the code i’ve been using (the object starts at origin, removing the need for subtraction beforehand):
float angle = Mathf.Atan(target_pos.y/target_pos.x);
Anyone know what i’m messing up? It’s giving me really crazy angles, like negatives when it’s in the 2nd quadrant -_-