Download

Create walls that AI can pass thru

Hi, I want to create “walls” in my level that certain AI-Characters can pass and see through, but the player can’t. (Think like some sort of force field). I thought this would be easy enough but I completely failed. So
I created a new ObjectChannel called “Semi Block” and set the wall pieces to collison type “Semi Block” and for the Capsule Component of my AI characters set Semi Block to ignore. This lead to some very strange behavior:

  1. The AI didn’t cross the wall (for test-purposes I boxed it in so it should cross it while randomly walking). But when I took control of the character I could walk through it.
  2. While my AI character seemed to stay inside the box somehow the distance between the player character and the AI character slowly decreased - just a few centimeters every tick, much slower than walking speed (I noticed this by accident because I left a “Get Distance To” for debugging purposes somewhere else in the code) and the AI acted accordingly performing some actions it should only do when in a certain distance to the character.

What am I doing wrong? How would you set something like this up? And why have I created Schroedingers AI that is simultaneously inside the box but also coming towards the player?

Hi, did you try to visualize the navmesh (Navmesh Content Examples | Unreal Engine Documentation) the AI uses and confirm that it generates inside the walls? Since the AI only uses the navmesh for navigation that means that if the wall blocks navmesh generation, then the AI won’t move through that.

As for seeing through the wall needs to ignore the collision channel that AI sight sense uses (Visibility by default but you can change that in the project settings).

1 Like

Oh yes - me stupid :smiley:
Thank you for putting me on the right track!