private void BuildHeightfield() { int width; int depth; NMGen.DeriveSizeOfCellGrid(mTileConfig.BoundsMin , mTileConfig.BoundsMax , mConfig.XZCellSize , out width , out depth); Heightfield hf = Heightfield.Create(width, depth , mTileConfig.BoundsMin, mTileConfig.BoundsMax , mConfig.XZCellSize, mConfig.YCellSize); hf.AddTriangles(mBuildContext , mGeometry.Mesh , mTileConfig.boundsMin , mTileConfig.boundsMax , mConfig.WalkableStep); // Merge for any spans less than step. if (hf.GetSpanCount() < 1) { FinalizeNoResult("Complete at heightfield build. No spans."); return; } mBuildContext.Heightfield = hf; if (PostProcess() && PostHeightfieldCheck()) { mBuildContext.Log("Voxelized triangles. Span count: " + hf.GetSpanCount(), this); mState = NMGenState.CompactFieldBuild; } }