0
Answered

How Can I Make AI Detect and Open Doors Blocking NavMesh Path (Behavior Module + Conditions)

Cr4shBarcode 8 months ago in Behavior updated by Marti (Lead Developer) 8 months ago 3

I have enemy AI following a patrol pattern via the Behavior Module. I'm trying to give him the ability to open closed doors that are blocking his path in the NavMesh. I have the idea to put a trigger box around the doors and use an "On Enter" kind of trigger, but I'm not sure how to reconcile this with the behavior module. Each door has a local "Is Open" bool. If "Is Open" is false, but the AI needs to go through it to reach its destination via the NavMesh, I want him to pause his Behavior, trigger an open door animation, and continue the Behavior where he left off. That way, when enemy AI is chasing the Player, they will not be deterred if the Player shuts a door in its face. I'm new to the Behavior Module and have absolutely no idea how to pull this off. Can anyone give any suggestions?

Unity version:
Game Creator version:

Answer

Answer
Answered

I would do this the other way around. The character should not be aware there's a door there. Just let him or her follow the patrol path.

The door, however, can have a big Trigger "On Enter" as you mention that detects when a character enters and when a character exists "On Enter" Trigger and "On Exit" Trigger. These should play the open door and close door respectively.

If you don't want the doors to appear like automatic doors, you can always play the gesture on the Invoker (character entering the door zone) like it's opening the door with the hand. If you limit the animation to play only on the upper body (using an Avatar Mask) it should look pretty good.

Cheers!

Answer
Answered

I would do this the other way around. The character should not be aware there's a door there. Just let him or her follow the patrol path.

The door, however, can have a big Trigger "On Enter" as you mention that detects when a character enters and when a character exists "On Enter" Trigger and "On Exit" Trigger. These should play the open door and close door respectively.

If you don't want the doors to appear like automatic doors, you can always play the gesture on the Invoker (character entering the door zone) like it's opening the door with the hand. If you limit the animation to play only on the upper body (using an Avatar Mask) it should look pretty good.

Cheers!

+1

Good idea! I'll try it! Thanks!

Cheers! Let me know how it goes :-)