top of page
Search

Unity Hearing Enemy

  • Nolan Roher
  • May 6, 2019
  • 1 min read

Here is an example of an enemy AI I made recently for an enemy that simulates hearing the player move: https://github.com/maniacalspy/GameAIFinal/blob/master/Assets/SoundEnemy.cs


In the player's movement script the player sends out a Physics.OverlapSphere with a radius based on their movement speed, and if the OverlapSphere makes contact with the enemy's collider then it invokes the PlayerFoundAction within the enemy's script, which then tells it the player's current location and sets that as the point to go to in order to search. The enemy then uses a NavMesh to move towards the player's last position, but this part could also implement A* navigation to find the best route to the player. After the enemy gets to the search point it returns to it's idle state, which in this script is simply staying in place until the player is detected.

 
 
 

Recent Posts

See All
Unreal Capstone Project GitHub Repo

https://github.com/maniacalspy/Nudge This is the link to my senior capstone project's Github Repo, the project has been my primary source...

 
 
 

Comments


  • LinkedIn Social Icon

©2026 by Nolan Roher-Brown.

bottom of page