I’ve noticed that agents appear to be floating when using the RecastJSPlugin. In the NavMeshParameters “ch” depending on the value the object will be that high off the ground. Is this a bug or do I have to negative position to compensate for this behavior?
Adding @Cedric our navmesh GURU
In order to create the navmesh, Recast builds a voxel volume from the geometry. the cs and ch parameters are used to define the resolution of that voxel.
Then, the navmesh is triangulated from the voxel.
depending on the polygons and the ch parameter, the navmesh will not be totally accurate regarding the geometry.
You can specify a smaller value for ch or try to tweak the geometry to get more acceptable tolerance.
In this PG, I’ve added a mesh slightly below the plane with a translation lower than the value of ch. So the end of the voxel will be closer to the box.
So if I understand this correctly, we are technically walking on the first voxel layer?
yes, that’s right.
Now before i go doubling up on meshes, this is the foreseeable intended behavior, instead of moving along the bottom of the first layer?
Depending on your geometry and workflow, you can try to tweak the geometry to improve consistency between geometry and navmesh.
Or you can do a raycast from the transform/agent X,Z position toward the ground to retrieve the Y value.
boxTNode.position.y -= NavMeshParamerters.ch
no, you can’t do that because depending on your geometry, the delta between the navmesh height and the geometry height is 0 < delta < ch. So the delta might not be uniform unless all your planar heights are multiple of ch. And even with multiple of ch for every walkable heights, if you change the geometry, the delta will change.
Thank you Cedric.