Purpose of Project Navmesh Walking?

In recent version 4.8 there is this feature available for character actors, saying in the release note:
New: Added optional raycast to conform NavMesh walking closer to underlying geometry

I would like to ask to please extend this explanation or point to documentation I can’t find.

How this feature affect performance?

48416-clipboard01.jpg

By default navmesh walking mode ignores all collisions with world geometry (UCharacterMovementComponent::SetNavWalkingPhysics) and uses navmesh polys as a ground level. While it’s being faster, it’s also less accurate and depends on navmesh generation parameters. After all, navmesh is just approximation of walkable space and doesn’t need to be identical with ground’s geometry.

New projection option is meant to improve navmesh walking mode, by adding sparse sampling of static world geometry. It’s doing a vertical line trace (point on navmesh +/- full capsule height * up/down scale) every few frames and smoothly interpolates height. Obviously there is cost in performance due to additional traces, but it’s still cheaper than regular walking mode and can be easily tuned by changing intervals.

Definitely useful for landscape terrains, but if your levels are mostly flat then you probably don’t need any additional projection.

1 Like

Great! Thanks for your quick detailed answer! Now I understand and next step should be start playing with it :slight_smile: Thanks again.

Thanks for the explanation, unfortunately it does not seem to work for me. I have enabled it, but changing the intervals does not make any difference. I guess the best way to tell whether it’s enabled would be to leave the navmesh and see whether the character falls through the ground, but I can’t make my character fall through the ground, he just stands there no matter whether I enable or disable navmesh walking. I tried setting the projection interval to 0 and to 1 and to 20, no difference. Is there anything else I have to set except the “Project Nav Mesh Walking” bool?

I don’t understand what you’re trying to achieve. Character won’t fall through ground in walking mode (collides with it) or navmesh walking (stands on navmesh poly).

You can tell if it’s enabled when you have AI agent moving in places where navmesh poly cuts into the ground. This happens usually at upper ends of ramps, especially for more coarse generation settings (bigger voxel grid: CellSize, CellHeight). Without additional traces AI will just stick to navmesh poly and go through ground’s geometry, with them AI will move on ground level, slightly above its navmesh poly.

Interval is defined in seconds, so I’d suggest keeping it in 0.1 - 0.5 range for most cases. Default values for trace offsets are quite big, so AI should be able to work with navmesh - ground height differences up to capsule height downward and 2/3 height upwards.

I meant that with enabled navmesh walking the AI can’t fall through the ground even where no navmesh has been generated, no matter what interval I set. Enabling navmesh walking has absolutely no impact for me, no difference in performance, no difference in how the AI walks, no difference at all, so I think it’s probably not enabled, although I set the bool to true. Is there any debug option I can enable to see whether navmesh walking is active or not?
And how would I disable tracing against geometry completely, is an interval of 0 disabling the tracing or setting it to trace every frame?

A few ways of checking movement mode:

  • during “Simulate In Editor”, select an AI agent and enable “AI debug” show flag (Show button in upper left corner, Developer > AI debug)

  • during game, press & hold apostrophe key [ ’ ] and look at AI agent to lock on debugger

  • use GetAll console command: getall charactermovementcomponent movementmode

Interval 0 will trace every frame, uncheck ProjectNavMeshWalking flag to disable it.

If there’s no navmesh at all, movement will switch back to regular Walking mode, so that’s probably root of your problem. Currently there’s no option to prevent from doing so, but feel free to modify UCharacterMovementComponent::PhysNavWalking function - look for single call to SetMovementMode(MOVE_Walking).

Thanks! You say Interval 0 will trace every frame, but how do I disable tracing against world geometry completely to get best performance? Do I have to set the Interval to something like 999999?

Just make sure you don’t have ProjectNavMeshWalking flag checked, it should be disabled by default. If you want to get rid off absolutely every trace, try disabling capsule component’s GenerateOverlapEvents flag as well, although doing so will make it unable to interact with triggers, etc.

I thought ProjectNavMeshWalking is for getting better performance, why you now say I should disable it for best performance? I want to disable tracing against world geometry so that the character relies 100% on the navmesh because I thought this gives best performance? Generate Overlap Events is of course disabled, since I need best performance. I want to be able to use 500-1000 AIs, so I optimize it as far as possible.

I never said it was added for speeding up movement code. Main purpose of this flag/mechanic is improving visual side by preventing AI from clipping through ground’s geometry which tents to happen if you stick to navmesh alone. You can always make use of it, e.g. as part of LOD, but keep flag disabled for max performance.

Thanks, that’s strange… I thought I remembered Mieszko saying in a twitch stream that the purpose of a new feature named “navmesh walking” would be to improve performance when using a lot of AIs because with this new feature the AI does not need to check for the ground below it but instead just checks for the navmesh, so the results with enabled “navmesh walking” are less precise, but the performance is a lot better.

And you said in the answer above:

“By default navmesh walking mode ignores all collisions with world geometry (UCharacterMovementComponent::SetNavWalkingPhysics) and uses navmesh polys as a ground level. While it’s being faster, it’s also less accurate and depends on navmesh generation parameters. After all, navmesh is just approximation of walkable space and doesn’t need to be identical with ground’s geometry.”

So you say it’s faster but less accurate. But now you said “keep flag [ProjectNavMeshWalking] disabled for max performance”. I think I am confused.

We’re talking about two different things.

Mieszko mentioned navmesh walking movement mode (EMovementMode.MODE_NavWalking), which is in fact faster than regular walking.

ProjectNavMeshWalking flag is a modifier used only by navmesh walking mode and it trades some of speed for visual quality (geometry conforming). Speed vs accuracy trade off can be “easily” configured by adjusting trace frequency - every few frames (10? 30? 100?) and code will interpolate from there.

1 Like

Thanks, that makes sense! So I don’t need to enable "ProjectNavMeshWalking " to enable “navmesh walking movement mode”, right? But how do I enable “navmesh walking movement mode” from blueprint? Since the “ProjectNavMeshWalking” bool is the only bool I found which sounds like “NavMeshWalking” I thought it’s needed to tick this to enable the “navmesh walking movement mode”. Then it also makes sense that I saw no difference, because I have never enabled “navmesh walking movement mode” since I have no idea where I have to enable it?

You can either set it as DefaultLandMovementMode in pawn blueprint’s default settings or change at runtime using CharacterMovementComponent’s function SetMovementMode.

I’ve been using navmesh walking for a while over multiplayer and realized a while back I needed “client side navigation” in order for ai to use it correctly in multiplayer. The issue I’ve run into lately is after an ai is killed from the level and I spawn a new one the authority spawned ai will never change it’s “is falling state on the clients side. Server is falling will be fine.