How do I make it so that the raycast is constantly going in a cone shape to represent vision?

I am trying to make a game where the player cannot see behind a wall and if an enemy sees the player it starts to move towards them. Is there a way to do this?

1 Like

Extract your character’s rotation, then use the expression “(Angle of Ray) + (Rotation)” which is A+B.
What that does, is look at what angle your character is looking at, then it just adjusts the ray’s angle to line up properly.

Btw, Welcome to the community

Also to detect the player/enemy you need to use several rays to make sure you fill in the gaps.
If you need any more help feel free to ask. :llama: