BUG:height Problem of Sample_TileMesh
sherlockxie opened this issue · comments
I'm not really sure I fully understand the issue you're facing. Could you upload the obj file and list the recast settings you're using, as well as the expected outcome?
Cube.zip
@grahamboree Sure, recast setting is the default value of the tileMesh Sample.
Thanks for the additional info! It looks like you're hitting the maximum heghtfield y-dimension, which is clamping the top triangles to the maximum. The maximum size of the rasterization heightfield along the y axis is defined here
recastnavigation/Recast/Include/Recast.h
Line 269 in b51925b
This is happening because you have geometry that spans about 4040 units and the default cell height for the heightfield is 0.2. The heightfield would need to be 4040 / .2 = 20200
cells high, but the maximum size it can be is 8191 cells high. Because triangles are outside the maximum size, they get clamped to the maximum height in rasterization, which results in the navmesh for cube A halfway between cube A and B.
This definitely could use better error signaling, and I'm not sure that clamping triangles like this (as opposed to discarding them) is the correct choice here, but nevertheless...
To work around this you can either increase the cellSize parameter, re-scale your geometry prior to sending it to Recast, or bake separate navmeshes for each cube. Hope this helps!
@grahamboree thx a lot! It works! :D