Ai doesn't hit the wall

Hi, I would like to make it so, that when my ai is either roaming or chasing the player, he doesn’t hit the walls, I have some idea of how that could be done, like offsetting him from collisions or something but no actual idea how to really do it.

Bellow I’m adding three pictures of my ai bp just for reference:




Hey there.
If your walls are affecting the navmesh, AI won’t be able to move through the walls, but disabling Can Ever Affect Navigation would result in AI trying to move through walls even when they can’t.

If you make it manually, something like detecting walls closest to AI in the direction from AI to the Player, you can teleport them through that wall, but that requires control over all the walls or collisions that might be in the way, so you would need to check for the next part with navmesh.

You can also change their Set Collision Response To Channel to ignore Pawn or whatever collision they use, but then again without navigation you would have to script a way for them to walk through walls and not fall through the ground.

I have no issues with the Ai going trough the walls or teleporting nor do I want that. I just want the ai not to hit the wall and yk put his hands for example trough it because the wall is thinner. So I just want him to keep away a few cm or smth.

Oh, I understood it the other way around.

• In that case you can try the easier option, that would be to increase the navmesh safety gap.
image
You have a RecastNavMesh actor generated in your level. You can play with the Agent Radius to increase the gap generated.

• A better looking but far more difficult solution would be to script the IK of your AI to react to close walls and obstacles.

• Another option is to increase their capsule radius.

There are many options you can choose depending on your preference and how much you want to complicate yourself.

1 Like