What is nav mesh used for?

I mean, for navigation, ok. but I never used a navmesh for anything, I thought I should just set my ground and walls for collision.

am I doing it wrong? how do you use navmesh? I was reading navmesh documentation and I’m more confuse now

Navmeshes aren’t needed for players. They use controls (w a s d, arrow keys, controllers, etc) to move. A navmesh is how non-player controlled characters know which parts of your level are capable of being walked on, so the AI can move around. Without a navmesh in your level, you can’t use the built-in AI.

So depending on what you’re doing, you might not need a navmesh at all.

hey thanks man, that makes a lot of sense.

however I encountered nav mesh actors while studying the VR template. from what I can see they are used for the vr interactions such as teleport and grabbing, but even for that I wonder if they are absolutely needed, as it’s still player controlled actions and not AI

I don’t know what a navmesh actor is. Later tonight, when I’m home, I’ll open up the VR template and try to figure out what it is, and why it’s there.

Off the top of my head, it could maybe be like a teleport location, instead of being able to teleport just anywhere? But I don’t know why that’d have anything to do with the navmesh. Maybe they’re something that can dynamically change the navmesh, to discourage ai from walking across a floor panel while it happens to be elecrified, or something. But that’s all speculation. Like I said, I’ll try to take a look later and figure it out.

Alright, so I was close with one of my guesses. The NavMeshBoundsVolume is in the VR template, because in the MotionControllerPawn’s TraceTeleportDestination function, ProjectPointToNavigation is used to get the closest allowable point to where you’re trying to teleport. ProjectPointToNavigation is over this way: http://api.unrealengine.com/INT/BlueprintAPI/AI/Navigation/ProjectPointToNavigation/index.html

You can see this working if you try to teleport inside one of the editor cubes. The circle showing where you’ll appear stays outside the cube, instead of going inside it. That’s because the navmesh knows you can’t stand inside the cube. And the navmesh knows that because the cubes have collision enabled. But let’s say you disable collision (for whatever reason). You STILL can’t teleport inside the cubes, and that’s because of the NavModifierVolume(s), which are creating dead-space in the navmesh which you can never reach.

I think the NavModifierVolumes are there just to show they can be used, because really, the EditorCube’s collision blocks the navigation (you can see that work, if you delete all the NavModifierVolumes from the template level). And unless you have a reason to, it’s probably better to just let the actual geometry modify the navigation. A good reason to use the NavModifierVolume could be… like a river. There’s nothing there blocking collision, but you still don’t want someone teleporting into it.

Generally in VR you wouldn’t want players going absolutely everywhere, so you project their teleport destination to the navmesh, which is only built in areas you want it. Otherwise if you teleport to collision, they would be able to teleport on anything that their aiming arc reaches.

Another use for projecting to navigation is that if the final destination is out of bounds, you can still get the closest point on the navmesh to where you want to go and teleport there instead.