Navigation mesh not working correctly

Images

Screenshot_993

Screenshot_992

The first waypoint is deep within the parts, therefore unreachable.
Screenshot_994

This is causing my NPCs to get stuck at the first node (the one to the right; my character is the target position). Happens in both studio and a real server.

1 Like

It looks like the navmesh simplification step is making it go underneath the platform part.
Do you have a repro place?

Ah, no, I forgot sorry. Will look into it.

Right, wasn’t hard for me to reproduce:

Two parts sitting on top of each other with (X, 1, Z). Also occurs when the top part is (X, 2, Z) and has its bottom edge on the ground.

The navigation mesh is just sitting on the ground and not changing at all.

File: NavigationMeshBug.rbxl (12.8 KB)

1 Like

For memory/performance reasons, the navmesh is not designed to reproduce 100% the world geometry.

In areas where the character can walk-climb without jumping, like in that rbxl you shared, it is valid to keep the navmesh flat. So I would say that works as planned.

The first case you reported is different because it looks like the character should jump.
So if you have that place, please send it and we’ll debug it.
Does Click-To-Move fail there too?

In the Click-To-Move implementation we raycast the waypoints to find a proper position for the indicators.
(See ClickToMoveController in the PlayerScripts)
Maybe you could use the same approach in your place.

That said, we should do a better job at not returning waypoints below the surface.

I’m not sure what you mean – why would the character jump? In this situation, the NPC is getting stuck in the middle. A solution to this on my part was to completely take the Y coordinate out of my walk to loop.

Click to move works, I’ll look into how I can apply it to my own code.

He means that the character should jump because in the screenshot, the right leg is partially inside the brick, and jumping usually fixes this collision issue.

I should probably have clarified my post a bit more then, as my character is actually the target of the pathfinding, not the source :wink:

The first waypoint (the one farthest from my character) is below the (hidden) NPC’s root position, meaning the NPC just gets stuck at the first waypoint.

The bricks also have CanCollide disabled, so that shouldn’t matter.

1 Like

Ah okay yeah that makes sense.

If you were the source then he is implying that the NPC can’t just walk over to the far right waypoint as the part it’s in is elevated higher from where you’re standing, it would have to jump to reach the waypoint position, but that doesn’t matter now that you’ve clarified.

1 Like