recastnavigation / recastnavigation

Industry-standard navigation-mesh toolset for games

Home Page:http://recastnav.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BUG:height Problem of Sample_TileMesh

sherlockxie opened this issue · comments

using an object with two cube exported as obj file from unity .Here is cube status:
Cube A size is (50,0.1,50), Position is (0,0,0)
Cube B size is(10,0.1,10), Positon is (0,4000,0)
using sample_TileMesh case to build navMesh ,that is how it look like this
image

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

static const int RC_SPAN_MAX_HEIGHT = (1 << RC_SPAN_HEIGHT_BITS) - 1;

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