can foe hear us?

I need some way to detect, can enemy character hear our player. I can check distance betwen player and foe, i can cast ray to check obstacle. But i dont know how to solve “corner” problem. Foe can hear me really good if he stays next to the corner, but raycast will say there is obstacle.
Is there any way to work with real sound in U3d?19348-corner.jpg

The player itself should cast spherical trigger around it, it’s size based on is the player running or walking speed/ loudness.

I think this is the rare time “sendmessage” is usable, or you could call a method by comparing tags. But sendmessage might be better because there can be many enemy’s.

When player moves and casts invisible sphere around him, you can get all gameobjects in that certain area, then run a tag search loop checking which GO are “Enemy”, then call a method or sendmessage to those gameobjects with coordinates where the sound came from, so instead of Foe automatically following the player, it will go where the sound was, which is realistic.

This is how it could look like. For calling a methods, that is located on “Foe”, you will need to getComponent and etc, so sendmessage might be a good idea as i said.

For sphere cast Unity - Scripting API: Physics.OverlapSphere
Basically you will have an array of all colliders inside that sphere, so from here can find anything, is it a foe, etc.

But as sendmassage takes only one parameter, i don’t if that is possible, but you could send a class object, which contains those two coordinates.

Here’s an interesting video, how it may look.