For the AI’s vision detection and hearing I stick quite closely to the method shown in the unity stealth tutorial, as it works for what I need. One additional feature I have added however, is a publicly triggered sound check function. By using a external script the detection script is given three inputs, sound origin, volume, and distance Falloff(using an animation curve). The detection script then uses the navAgent to make a path from it to the sound origin, gets the overall distance and checks the final volume as affected by the falloff. If the result is more than the AI’s hearing threshold, it sets the sound origin as a investigation target and sets it as it’s destination.
While a bit overcomplicated this feature will allow me to test out the values that work for sound detection in my game, in the final detection script, I imagine I will have a universal curve value for sound falloff.