ikpil/DotRecast

[Help] Nav mesh being generated upside down

Doprez opened this issue · 4 comments

Doprez commented

I finally have a mostly working nav mesh result. The main issue seems to be that the navmesh is being generated on the ceiling of the object as seen in the image below.
Each cube in the image represents a point on the nav mesh.
image

Is there a setting I am missing to have it generate on the opposite Y axis?

Doprez commented

OK, so I found a work around. I am assuming this has to do with the right vs left handed design of the engine I am using but I am not 100% sure. In the image below you can see what I did to generate a proper mesh.

  1. I make the X and Y value of each vertex negative
  2. I generate the nav mesh with the inverted mesh
  3. finally invert the X and Y again to get the correct result

image

This does not feel like an ideal solution so if anyone knows a better way I would love to hear any ideas or maybe a feature of this library I am missing.

ikpil commented

Hello.
I use Unity3D, and I've encountered a similar issue.

From the perspective of library porting, instead of modifying the library, I changed the coordinate system for input and output values when using NavMeshQuery.

In the context of Unreal Engine using the C++ recastnavigation library, I'm trying to examine Unreal's navmesh to find a solution.

I hope my situation provides some help.

ikpil commented

I hope this project, which is still in development, can be of some help.

Doprez commented

Ok, so I have come back to this due to getting some other stuff done that I wanted to use with this.

I have been looking at the Stride usage of the C++ recast library and they are converting each object to left handed inputs.

var meshData = GeometricPrimitive.Cone.New(coneDesc.Radius, coneDesc.Height, toLeftHanded: true);

and for Convex there is some manual conversion

for (int i = 0; i < hull.Indices.Count; i += 3)
{
    indices[i] = (int)hull.Indices[i];
    indices[i + 2] = (int)hull.Indices[i + 1]; // NOTE: Reversed winding to create left handed input
    indices[i + 1] = (int)hull.Indices[i + 2];
}

So I think that and Ikpils earlier comments answer this question. I will be testing more nav mesh generation with the new physics library being implemented in Stride in the coming weeks. Nicogo1705/Stride.BepuPhysics#28