Nav-mesh; avoid uphill and seek downhill?

Hello,

I am trying to figure out how to make the navigation system aware of things like slopes and other properties in its pathfinding.

For simplicity’s sake; let’s take a hill. If there is a longer, easier, access path vs the tougher alternative of climbing up the slope, I would like the system to be able to select different routes depending on how important it is to get there fast or not; i.e. straight up the hill if some ‘hurry up’ weight parameter is high, while around the longer path if the parameter is set low. Similarly, if I then want to go back, downhill is fine in both cases, so the solution would not be the same depending on direction.

Is this possible using nav-meshes or will I need to do my own path finding?

Hey @x_jdj_x!

What you are looking for is custom Nav Mesh areas and query filters. You can give hills a higher entry and/or travel cost so your AI will prioritize the easier route without completely removing the ability to go up the hill.

I hope the above the above is the solution you need!

Hello @Quetzalcodename !

Thank you for your suggestion, but as far as I have understood these concepts they introduce a static “cost” or “penalty” to traversing the marked areas. This is bi-directional, i.e. it is equally costly to go up the hill as down. Or have I understood this wrong?

Hey @x_jdj_x,

Both yes and no. You are correct that once in that zone the value of traversing the area is the same, though the AI will actively seek the shortest path to the lower value of the zones it can traverse. There are also Entry costs that you can set as well which are one directional (enter not exit). You can also use those to set barriers, although the travel cost may do you better.

In short, if your hill is highlighted in a higher travel cost and your lower height area is next to it, your AI should in theory actively seek a lower zone next to it if available.

You can still change these factors with multiple queries set at runtime as well.

I hope the above helps guide you toward the solution you are looking for!

Ok - I will mark this as the solution as you do have replied to what I asked about. It was not entirely what I had in mind, but it is sometimes hard to transfer a thought into words. :slight_smile:

Thank you for assisting me understanding the system, but I suspect that I will need to dig into custom pathfinding. The root of the problem is that I wanted to precompute the solution using “Find Path to Actor Synchronously” over a longer period of time. Then dynamic navmesh updates are not really a possibility but a more procedural approach is required.

Slopes for instance are interesting because a movement along the same elevation line would be “normal” while across it easier/tougher.

But anyway; thank you!