You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? I need to know the angle between two 2D unit vectors, something like Unity’s Vector2.Angle
What is the issue? I need to be able to determine if an object is within a certain radius and field of view of another object, where I need the angle between the forward direction (normalized) and the direction to the target (normalized).
What solutions have you tried so far? I have looked for solutions, but none of them seem to match what I need
What I’m trying to do, is something like this:
if Angle(forward, dirToFood) < viewAngle / 2 then
...
end
It might help if you draw a triangle to visualize how to do this.
If you have two points then you can form a right triangle and it becomes obvious that the angle between them is just math.atan(dy / dx) where dy = p1.Y - p2.Y and dx = p1.X - p2.X
However you might want to use math.atan2 because it compensates for quadrants where dx or dy could be negative.