Get angle between player and a vector

Hello everyone! I am trying to do something fairly simple, but I am pretty new to this engine, and I find myself in need of som help.

I have this collider, and I want to find or get the angle between the player and a Max Angle value that I set in the editor. Whenever the player is not directly in front of the collider (not 90 degrees), I want to get the angle between the player and the edge of the collider in realtime. When the player is directly in front of the collider the angle is at 90 degrees.

So, when the player is not in front of the collider, it looks something like this:


Which is the angle I want to find.

And when the player is in front of the collider:

Could anyone help me out?

Something like this would do it

It assumes the collider has it’s X axis facing out from C.

2 Likes