Exemple #1
0
    bool checkForVoxelsInCollider()
    {
        float   step   = vxe.voxel_size * 0.5f;
        float   eps    = vxe.voxel_size * 0.1f;
        Vector3 center = mycollider.bounds.center;
        Vector3 max    = center + mycollider.bounds.extents + Vector3.one * eps;
        Vector3 min    = center - mycollider.bounds.extents - Vector3.one * eps;


        for (float i = min.x; i <= max.x; i += step)
        {
            for (float j = min.y; j <= max.y; j += step)
            {
                for (float k = min.z; k <= max.z; k += step)
                {
                    Vector3 vc = new Vector3(i, j, k);
                    if (vxe.isVoxelThere(vc))
                    {
                        vxe.grid.unSetVoxel(vxe.getVoxelCoordsFromPt(vc));
                        return(true);
                    }
                }
            }
        }

        return(false);
    }