Hello,
when using RecastGraph.collectionSettings.onCollectMeshes
and adding mesh as simple cube with settings for modifying area only, it always produces unwalkable tiles where navmesh is not generated for some reaason.
Is this intended behavior, or maybe a bug?
This is the code used, setting tiles with Road tag, which is 2, always produced non walkable tiles without navmesh:
public enum PenaltyCategory
{
None = 0,
Wall = 1,
Road = 2,
GateEntrance = 3,
NonWalkable = -1,
NonPlayable = 4
}
private Action<RecastMeshGatherer> CollectMeshes()
{
return gatherer =>
{
Debug.Log("Collecting Meshes");
foreach (KeyValuePair<Vector2Int, PenaltyCategory> pair in penalties)
{
Vector3 position = pair.Key.ToWorldPosition3D();
Vector3 size = Vector3.one;
Bounds bounds = new Bounds(position, size);
// Add mesh buffers to the gatherer and get the meshDataIndex
int meshDataIndex = gatherer.AddMeshBuffers(vertices, triangles);
// Transform the vertices to the world position
Matrix4x4 matrix = Matrix4x4.TRS(position, Quaternion.identity, Vector3.one);
RecastMeshGatherer.GatheredMesh gatheredMesh = new RecastMeshGatherer.GatheredMesh
{
meshDataIndex = meshDataIndex,
area = (int) pair.Value,
indexStart = 0,
indexEnd = triangles.Length,
bounds = bounds,
matrix = matrix,
solid = true, // tried both true and false, same result
doubleSided = false,
flatten = false,
areaIsTag = pair.Value != PenaltyCategory.NonWalkable // True for all other areas
};
Debug.Log($"{pair.Key} {gatheredMesh.area} {gatheredMesh.areaIsTag} {gatheredMesh.solid}");
gatherer.AddMesh(gatheredMesh);
}
};
}
The object itself does not have any modifiers that would prevent generation of navmesh there.