AI Navigation only on runtime placed roads

Hi All

Im looking at building an RTS which will involve AI workers carrying out Jobs. They will only be able to move to these jobs via roads that the player places at runtime.

My first thought was to place a NavMesh over the whole level and then create a nav mesh modifier on the roads when placed that had a lower cost than the default navmesh.

This works to a point, but if the road is not optimal, the AI can decide to path across the default navmesh instead of using the road. Or if there are no roads it will still move through the default navmesh

How would you go about solving this? I’ve been looking for a way to have the default nav mesh behave like a “null” nav mesh modifier, but cant find a way to do that. It also doesn’t seem possible to have multiple modifiers in the same space. ie place a “null” modifier over the whole default mesh and then another one on the roads. In this case the null modifier always wins.

Any help would be appreciated.

I solved this by creating a new blueprint that derived from NavArea, called VehiclesAllowed

I created a navigation filter blueprint for my vehicle and added the VehiclesAllowed nav area and the NavArea_Default into it, and set the IsExcluded check of the NavArea_Default to true.

Finally I set the Default Navigation Filter Class in my AI Component to the filter created above.

My roads then each had a NavModifier on them with the Area Class set to VehiclesAllowed

The gotcha for me here was that the actor for my move to task was quite large and not enough of it was in my VehiclesAllowed NavModifier, once this NavModifier was big enough the AI was able to move to it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.