void MakeGrid() { var bounds = _voids .GetComponentsInChildren <MeshCollider>() .Select(c => c.bounds) .ToArray(); var voxelSize = float.Parse(_voxelSize); _grid = Grid3d.MakeGridWithBounds(bounds, voxelSize); // shortest path to test if connectivity is working var faces = _grid.GetFaces().Where(f => f.IsActive).ToList(); var graphEdges = faces.Select(f => new TaggedEdge <Voxel, Face>(f.Voxels[0], f.Voxels[1], f)); var graph = graphEdges.ToUndirectedGraph <Voxel, TaggedEdge <Voxel, Face> >(); var start = _grid.GetVoxels().ElementAt(2); var end = _grid.GetVoxels().ElementAt(250); var shortest = graph.ShortestPathsDijkstra(_ => 1, start); shortest(end, out var path); var current = start; _flowPath = new List <Voxel>(); _flowPath.Add(current); foreach (var face in path) { current = face.GetOtherVertex(current); _flowPath.Add(current); } }