public static void CheckVolume(PNavMesh pNavMesh, int xStart, int xEnd, int zStart, int zEnd, int yStart, int yEnd, int scale, Action <int, int, int, int, int, int> callback)
        {
            PShapeOverlapResult3D result = new PShapeOverlapResult3D();

            Fix64Vec3 size     = pNavMesh.gridSize * (Fix64)scale;
            Fix64Vec3 toCenter = Fix64.half * size;

            int scaledXEnd = xEnd / scale;
            int scaledYEnd = yEnd / scale;
            int scaledZEnd = zEnd / scale;

            for (int x = xStart; x < scaledXEnd; x++)
            {
                for (int z = zStart; z < scaledZEnd; z++)
                {
                    for (int y = yStart; y < scaledZEnd; y++)
                    {
                        int scaledX = x * scale;
                        int scaledY = y * scale;
                        int scaledZ = z * scale;

                        Fix64Vec3 l;
                        Fix64Vec3 u;
                        pNavMesh.GetAABB(scaledX, scaledY, scaledZ, out l, out u);

                        Fix64Vec3 center = l + toCenter;
                        Fix64Quat rot    = Fix64Quat.identity;

                        Parallel3D.OverlapCube(
                            center, rot,
                            size.x, size.y, size.z,
                            -1,
                            result);

                        if (result.count > 0)
                        {
                            callback(scaledX, scaledX + scale, scaledZ, scaledZ + scale, scaledY, scaledY + scale);
                        }
                    }
                }
            }
        }
        public static void CubeCastInRange(PNavMesh pNavMesh, int xStart, int xEnd, int zStart, int zEnd, int yStart, int yEnd)
        {
            PShapeOverlapResult3D result = new PShapeOverlapResult3D();

            if (xEnd > pNavMesh.xCount)
            {
                xEnd = pNavMesh.xCount;
            }

            if (zEnd > pNavMesh.zCount)
            {
                zEnd = pNavMesh.zCount;
            }

            if (yEnd > pNavMesh.yCount)
            {
                yEnd = pNavMesh.yCount;
            }

            Debug.Log("CubeCastInRange:" + " xStart=" + xStart + " xEnd=" + xEnd + " zStart=" + zStart + " zEnd=" + zEnd + " yStart=" + yStart + " yEnd=" + yEnd);

            for (int x = xStart; x < xEnd; x++)
            {
                for (int z = zStart; z < zEnd; z++)
                {
                    PNavColumn column = pNavMesh.columns[x, z];

                    int surfaceIndex = -1;

                    for (int y = yStart; y < yEnd; y++)
                    {
                        Fix64Vec3 l;
                        Fix64Vec3 u;
                        pNavMesh.GetAABB(x, y, z, out l, out u);
                        Fix64Vec3 center = Fix64.half * (l + u);
                        Fix64Quat rot    = Fix64Quat.identity;
                        Parallel3D.OverlapCube(
                            center, rot,
                            pNavMesh.gridSize.x, pNavMesh.gridSize.y, pNavMesh.gridSize.z,
                            -1,
                            result
                            );

                        PNavNode node = new PNavNode();

                        node.lower       = l;
                        node.upper       = u;
                        node.objectCount = result.count;
                        node.islandIndex = -1;
                        node.point       = new PNavPoint(x, z);

                        if (result.count > 0 && y > surfaceIndex)
                        {
                            surfaceIndex = y;
                        }

                        column.nodes[y] = node;
                    }

                    column.surfaceNodeIndexes[0] = surfaceIndex;

                    if (surfaceIndex >= 0)
                    {
                        column.type = ParallelNavColumnType.Walkable;
                    }
                    else
                    {
                        column.type = ParallelNavColumnType.Empty;
                    }
                }
            }
        }