I’m currently trying to make my AI follow my player. However, when there are obstacles in between, instead of avoiding them, it keeps running in the same direction. I have made sure the navmesh in the region is no longer green (when I press the P key) and that there are alternate ways for it to reach the destination (such as moving to the side and up the ledge). The AI I used is a child of the Detour Crowd AI Controller. Here’s a video of what’s happening. - YouTube
I have tried to change the AI Task “AI MoveTo” to AI Navigation “Move to Actor” and AI Navigation “Move to Location” as well, enabling pathfinder, but it does not seem to fix the issue.
It sort of looks like the AI is trying to get up where the navmesh is valid but it’s too steep. Maybe try to increase walkable floor angle in character movement component or reduce the Agent max slope in Project settings. Also you can debug in PIE by pressing ’ on your keyboard and then 5 to see the navigation.
Thanks for your reply Hmm if possible, I would prefer for the AI to move around the ridge than to walk up it. I tried the debugging to show the navigation and it looks like the nav mesh it’s using is different to the one that’s shown when I press P when the game isn’t running. I’ve attached a screenshot showing the nav while the game is running. For some reason it doesn’t seem to register the area in which it’s not able to traverse and takes it as a path it can take. How would I fix this? Is it something to do with the NavData?
In Game:
(I did change it a little while trying to fix it so it looks slightly different to the one in the video)
You can tweak your navmesh data in project settings>Engine - Navigation Mesh. Also is your navmesh updating automatically when you add obstacles? Have you build it from the toolbar Build option?
I’m not too sure what I’ll need to tweak to get it to follow the navmesh shown in the editor though. I tried changing the Agent Max Slope down from 44 to 30 but it had no visible effect. I have built the nav through the tool bar with every change I made to the map.
I managed to fix the issue by deleting the current nav mesh and putting a new one in the map. No idea why it made a difference, but everything seems to work now!