Updating Nav Mesh after player character movement

Stormrage256
Sat, 03 Jan 2015 13:08:14 +0000
World Creation

Hi, I’m working on a game prototype similar to XCOM: EU. At the moment, I’m working on the pathing for AI and player characters. I’ve already got a dynamic grid based movement setup working and have been using the default pathing algorithm that came with UE4. Since I’m spawning grids only around the mouse click, I’m showing the path from the actor location to the destination point using splines and ‘path to location’ node. However that’s when I hit a problem with navigation. I noticed that all my characters that are placed in the level before level start do not follow the shortest path during their first movement command. In fact, they usually take a step in some random direction based on the nav mesh cut around them, and then move towards the destination. Until I got the splines working, I didn’t give much attention to this as it was only happening during the first movement turn. You can see it here:

So after checking navigation I’ve realized that if my character’s collision affects the nav mesh, it creates a hole in the nav mesh around their initial position. But once they’ve move out of that region, there still is a hole in the same place and nothing near their new position. As a result, now no one can move to this starting location and there is no pathing around this character’s current location.

If I have the player characters to not influence the nav mesh, they move correctly. But whenever they have to path around the other characters, they just bump in to them. I’d like to know if there is any way to tackle this internally in UE4, or if I would have to go and implement some custom A* algorithm for pathing.

7 posts - 1 participant