private void findHitVoxel(Vector3 hitPoint) { ThreadSafeVoxelisation.GridSize gridSize = aabcGrid.GetSize(); Vector3 center = aabcGrid.GetCenter(); Vector3 difference = hitPoint - center; short xOff, yOff, zOff; xOff = (short)(difference.x / gridSize.side); yOff = (short)(difference.y / gridSize.side); zOff = (short)(difference.z / gridSize.side); hit.x = (short)(gridSize.x / 2 + xOff); hit.y = (short)(gridSize.y / 2 + yOff); hit.z = (short)(gridSize.z / 2 + zOff); }
void DrawMeshShell() { if (grid != null) { if (drawMeshShell && (grid != null)) { var cubeSize = new Vector3(cubeSide, cubeSide, cubeSide); var gridSize = grid.GetSize(); for (short x = 0; x < gridSize.x; ++x) { for (short y = 0; y < gridSize.y; ++y) { for (short z = 0; z < gridSize.z; ++z) { var cubeCenter = grid.GetAABCCenterFromGridCenter(x, y, z) + grid.GetCenter() + meshShellPositionFromObject; if (grid.IsAABCSet(x, y, z)) { Color color; if (colors.TryGetValue(colouring[x, y, z], out color)) { Gizmos.color = color; Gizmos.DrawCube(cubeCenter, cubeSize); } } else if (drawEmptyCube) { Gizmos.color = new Color(0f, 1f, 0f, 1f); Gizmos.DrawCube(cubeCenter, cubeSize); } } } } } } }