so im making a stealth game where the enemy will patrol around, enemy can see 110 angle in front of them, and the player need to avoid them and get to the finish point, player can hide behind object where the enemy cannot see. I have been looking for different solution but still nothing came up, need help with the script for raycasting.
Here’s what I would do.
Use an invisble cone object. When the cone collides with the player send a raycast towards him. If the player is hiding behind an object the raycast won’t hit him otherwise it will
This way you only raycast when you need to, when the cone collides with the player. You can make the cone be 110 degrees.