PointOnNavMesh not working anymore in 3.7.2

Hello,

We just updated to 3.7.2 and now it looks like PointOnNavmesh returns false even if we are clearly inside the navmesh.
It happens often with long tile edges and it depends on the way you’re going.

We’re using recast graph with tile of size 128.

Here is a screenshot:
As you can see the unit is trying to move from left to right but is blocked at the edge of the triangle. Function PointOnNavMesh return false.
Observation: If i move to the “top” of the triangle I’m trying to enter (the one were the top of the ugly red arrow is) the unit is able to cross the triangle correctly.

Any help will be gladly received.

Thanks.

L.

Hi

Ouch. Seems I have introduced a bug when I changed the way the lookup structure for nearest nodes works.
I will try to fix it as soon as possible (and add more unit tests).

Thanks for reporting the bug.

To fix it temporarily I think you should be able to replace the RecastGenerator.cs script in 3.7.2 with the one from 3.7 and it should work fine.

Alright!

Script reverted to 3.7 version and few compile errors fixed (new BBTree(tile) => new BBtree()) and all looks well.

Thanks a lot.

Keep us posted when the fix is up.

L.

Unfortunately I am not able to replicate the bug. Do you think it would be possible for you to share a small example scene with me so I can debug it?

Hello Aron,

I’m quite busy right now but I’ll send you something asap.

Thanks,

L.

Hello aron,

Here is a quick way to reproduce the issue.

I used your example scene for recast graph in a brand new project (completely empty with only your plugin in it)
I take the liberty of scaling some elements and add some colliders and navCutter along with a tile handler.

I also added a ClampToNavMesh script on the bot that use the same function we use in our game.

You can download the test project here

Here is where the issue arises:

When the bot moves to the yellow points it crosses a bunch of super slim triangles and you should notice a small “jump” at that moment. Sometimes the bot is even teleported close to a column.

Hope it helps.

Thanks,

S.

Hi

Found the bug!
Took a while to track down. Was a sneaky off by one error causing one vertex of every node to be ignored.

Entire diff

-    for (int i = 1; i < nverts; i++) {
+    for (int i = 0; i < nverts; i++) {

Just uploaded 3.7.4 which includes a fix for this.