Very Large Vertex Numbers in Recast Mesh


#1

Hey there,

I am attempting to use recast mesh on a completely flat terrain object as a demo. There are a few cubes in the map with layer masks marked as Water or Unwalkable.

The recast mesh says that it generates just fine, however it will not render in the Unity editor. I debugged it and see that I am getting Int3s out of the graph with absurdly large values, in the 6 figures. It seems that when the mesh transforms from voxel that the numbers get insanely large, however even then, then numbers seem disproportionately large.

When I save the mesh out as a .obj and render it in a viewer, it looks correct, but I can’t seem to figure out why it won’t render in the editor. I have Show Surface and Show Edges selected.

Thanks for any and all help. I can continue debugging to get to the bottom of it, but I was hoping for someone to point me in the right direction for something I’ve done wrong on the input side.


#2

Will update here as I continue to debug. I think this might also boil down to Vector conversion. Int3 has a precision multiplier that might be the cause.


#3

This boils down to using non unity math types again. Conversion under the hood was not factoring in precision for the Int3. Sorry for spamming the boards! I hope this helps people in the future!


#4

I’m not quite sure what you were trying to do, but in any case. You can convert between Int3 and Vector3 using an explicit cast like so:

Int3 p = (Int3)someVector3;
Vector3 p2 = (Vector3)someInt3;

and that will automatically take care of the coordinate multipliers.


#5

Yeah, I saw that. I’m not using Unity’s Vector3, so I had to grab the precision multipliers myself. Was my fault.