- Home /
Question by
slushieboy99 · Aug 21, 2020 at 12:06 AM ·
ainavmeshnavigationprocedural generationprocedural-terrain
Having trouble getting NavMeshBuilder.CollectSources to work.
I'm getting a really strange error with NavMeshBuilder.CollectSources. Initially I was getting 0 sources when running this, so I decided to try a huge bounding box and every layer in the game. What a strange outcome, every OTHER layer seems to find all sources in the game. My terrain is on layer 8, and mostly everything else is on layer 0. Neither of these return any sources, only every ODD NUMBERED layer does. This is so strange, here is my code:
Bounds bounds = new Bounds(new Vector3(position.x, 0, position.z), new Vector3(10000, 1000, -10000));
bounds.Encapsulate(new Vector3(10000, 0, 10000));
bounds.Encapsulate(new Vector3(-10000, 1000, -10000));
for (int i = 0; i < 20; i++) {
NavMeshBuilder.CollectSources(bounds, i, NavMeshCollectGeometry.RenderMeshes, 1, new List<NavMeshBuildMarkup>(), buildSources);
Debug.Log("NUMBER OF BUILD SOURCES[" +i+ "]: " + buildSources.Count);
}
Comment