Top down raycasting

Hello! I’m currently making a top-down shooter game and I trying to implement raycasting so enemies can detect the player. But how can I set the raycasting only when the player is at front of the enemy? Thank you

Change the raycast angle to angle of enemy whenever it is facing the player.

Can you tell me in detail how to do that? I mean how to calculate the angle

You can do:

See this to know how to use it:

Thanks! I have watched the video but now I’m still wondering what is the coordinate of pointX("Vision) and pointY(“Vision”) in the video. Do you know?

they are somewhat like eyes
from where raycast starts

Thanks for the explanation!