Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How to make AI enemies detect footstep sound of a player and then trigger the SetDestination method

Hello all, I am new to game development and its mostly a past time hobby.

Back to my question!!! I have created a zombie FPS where AI zombies detect the player's position and then chase the player. But to be more realistic, my goal is to have a sound detection system on AI so that they will hear the footsteps of the player's running (Shit+) and get triggered. Also, if the player just walk slowly then the AI shouldn't be triggered so as to get behind the AI quietly to kill them as a game strategy.

Has anyone come cross a solution for this? Please let me know


  • JeetJeet Member

    Hey @Waldo_Machine

    Just make two bool in your player movment script

    isWalking and isRunning

    in your meathod where your player sprints set isRunning = true

    and in your meathod where your player runs set isWalking= true

    pass thesee two variables in the enemy script and add this in your update function(more precisely in the if statment where you make the enemy follow player)

    if isRunning = true

    then makes th enemy setdestination to player or if isRunning = false do nothing

    Hope it helps!!!!!!!!!

Sign In or Register to comment.