I would like to create a 2D UI widget which is an arrow pointing towards an actor. This widget rotates around the center of my screen like a clock hand (0 degrees is pointing at noon) and points to the target actor. I am making a flying game and this would be like the radar tracker. Its also very similar to the circular damage source indicators you see in fps games.
I am pretty bad with vector math, but given my actor location, my target actor location and my forward vector (and any other information I need), how can I derive the angle I need to rotate the widget to?
I made a solution that seems to work. It feels a bit off, and its probably not the most efficient way to go about this, but visually, I can’t see anything too wrong about the behavior so I’ll post the code for what I did: