0
\$\begingroup\$

I'm an absolute beginner in Unreal Engine, so sorry for any strange mistakes, formatting, etc. I'm trying to make a game for a project where an enemy chases the player through a maze when it spots the player, but when there's no player it roams around the maze. I have the following blueprint:

roamMethodSnip

Every time I run it, it has varying outcomes. Sometimes the enemy will move around a few times, then randomly stop. It won't return a fail message or move. Other times, it will send a single fail message as soon as the program is run, then not return anything else. And other times, it won't send anything at all or move and just stand there. It'll also sometimes simply turn ~95 degrees to the left then stop.

There's also the issue that the enemy takes the same path every trial, even though it's supposed to choose a random point and move to it.

The enemy easily chases the player through the maze and won't get stuck anywhere, but for some reason the enemy stops moving when it's executing the roam method.

I tried adjusting the radius in the GetRandomPointInNavigableRadius part, but that didn't affect anything. I also tried making the character smaller in case it was getting stuck on certain turns, but that also didn't affect it. Removing the delay made it work a few times, but then it went back to not working after a few trials.

Here's the rest of the code for reference:

fullProgramSnip

and a picture of the maze:

mazeSnip

and the enemy's width relative to the maze path:

charWidthSnip

Thank you for any help!

\$\endgroup\$
1
\$\begingroup\$

By the looks of it, your character is causing its own problems with navigation. The lack of green underneath suggests that it is blocking the NavMesh.

In the Blueprint, select the Capsule then in the details panel, search for Navigation.

One of the options is "Can affect navigation". Uncheck this and you should see the area under your AI go green and it should be free to move.

\$\endgroup\$
1
  • \$\begingroup\$ Thank you for the help! I found the Navigation part of the details panel, but I couldn't find the "Can affect navigation" option. There's a drop-down called "Area Class" and two checkboxes called "Dynamic Obstacle" and "Fill Collision Under." \$\endgroup\$ – inky Mar 19 at 3:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.