--mikko
--mikko
What's chf.spanCount when the crash happens? Can you post screenshot
of duDebugDrawCompactHeightfieldRegions()?
--mikko
On Sun, Sep 25, 2011 at 9:06 AM, Josh Klint <jkl...@leadwerks.com> wrote:
> The problem was the tilesize parameter was too low (though the
> bounding box was fine).
>
> Now I get an exception on line 697 in RecastContour.cpp:
> if (flags[i] == 0 || flags[i] == 0xf)
>
> According to the Visual Studio debugger:
> i = 3997806
> chf.spanCount = 3040357
>
> So it looks like it's trying to access beyond the length of the
> flags[] array.
Maybe you're missing that you need to call the Recast stuff all your
tiles? See buildAllTiles() in the tile sample:
http://code.google.com/p/recastnavigation/source/browse/trunk/RecastDemo/Source/Sample_TileMesh.cpp#817
First it calculates the voxel dimensions for the whole level bounding
box, from that it calculates how many tiles there are (tw,th) and then
in then in the loop it calculates all the tiles.
That is the reason the tile builder should take tile location as
input, so that you can use the same build process when a tile changes.
Build all can be preprocess which happens at level export time.
--mikko
If you want to use tiles, then you decide the tile size yourself. If
you wish to update the tiles at runtime, I'd test tileSizes between
16x16 to 128x128. Depending on how large objects you have and how much
perf and memory you can put to update the tiles. You adjust the
tileSize in the RecastDemo to see how it affects the navmesh.
If you want to use only one tile (that is, solo mesh), then you can
use the provided function to calculate the tile size rom bounding box.
--mikko