AI Getting stuck on walls (Horror Game)

Hi! So I’m making a horror game with a chase sequence, but the AI keeps running into walls and getting stuck. I tried looking through forums and stuff to find a solution, but nothing worked.

Any help is appreciated!

Hello @UkkosDuck ,
First of all, I would try the simplest solution first:

Make sure the NavMesh is properly placed first, tjen press P to visualize the NavMesh, select the wall and look for the option called “Can Ever Affect Navigation”, disable it, since that should prevent the AI from trying to run into the wall and getting stuck.

If that doesn’t solve the issue, could you show how your Behavior Tree is set up? That would make it easier to identify where the problem might be coming from

Hope it helps!

hi, adding to above answer, when its stuck, is ai move to fails or giving success ? you can visualize behavior tree by keeping side by side and maybe share the video or print string also will do

First, because you have a nav link in the corner; second, use EQS so you calculate a route avoiding corners :eyes:

Hi! So here’s a video of the “Behaviour tree”.

It also seems the problem lies within the “Navmesh” as the second there is a corner, it gets stuck

The AI “base” is off a “Horror Template” So I’m not as familiar with the behaviour tree system.

Spots he got stuck at:
Also video of the behaviour tree:

in chase player task, you have not connected success or fail to finish execute, maybe that’s why ai stops?

Hello again @UkkosDuck
From what can be seen in what you shared, it doesn’t seem to be an issue with the BTR, so you could try the following:

It’s possible that the NavMesh is broken, so to make sure that’s not the issue, go to Build and then Build Paths. This should rebuild the NavMesh correctly.

I don’t really see much point in having the NavLinks there, since those are used so the AI can move from one point to another even when there isn’t a directly connected NavMesh. They are usually used for jumps, going down platforms, climbing, stairs, etc. So you could try removing them and see if the behavior improves.

Also make sure the walls have their collisions set to Block All, just to rule that out as a possible cause.

Then, inside BP_AI_Enemy, make sure it has the following configuration:

Collision Presets: Pawn
Collision Enabled: Collision Enabled (Query and Physics)

And to verify what it is actually colliding with, and to check if the issue comes from the capsule, copy the code above into the Event Tick.

Then press Play and, in the console, type:

show navigation
show collision

That will let you properly see if the problem is related to the capsule or not.

In an old post I found, they mentioned a very similar issue, and the solution was to recreate the character capsule. After doing that, it worked correctly for them, so you could also try that. I’ll leave the post here so you can check the mentioned solution.

Also try adjusting the Acceptance Radius of the AI Move To node.

There’s something that looks strange to me, and it’s the square box collision on the character. That could also be causing the issue.

where can that template be found? Maybe if none of the above works and it can be tested, a solution could also be found from there.

Hope it helps.