public void CreateOcclusionMesh(MeshHideAsset meshHide)
        {
            if (meshHide == null)
            {
                return;
            }

            CreateOcclusionMesh(meshHide.asset.meshData);

            int[]      triangles    = _occlusionMesh.GetTriangles(0);
            BitArray   bitArray     = meshHide.triangleFlags[meshHide.asset.subMeshIndex];
            List <int> newTriangles = new List <int>();

            if ((bitArray.Length * 3) != triangles.Length)
            {
                if (Debug.isDebugBuild)
                {
                    Debug.LogError("BitArray length does not match Triangle length!");
                }

                return;
            }

            //Now let's trip away the triangles
            for (int i = 0; i < bitArray.Length; i++)
            {
                if (bitArray[i])
                {
                    int triIndex = i * 3;
                    newTriangles.Add(triangles[triIndex]);
                    newTriangles.Add(triangles[triIndex + 1]);
                    newTriangles.Add(triangles[triIndex + 2]);
                }
            }
            _occlusionMesh.SetTriangles(newTriangles, 0);
        }
 public void UpdateOcclusionMesh(MeshHideAsset meshHide, float offset, Vector3 pos, Vector3 rot, Vector3 s)
 {
     //Let's call CreateOcclusionMesh to reset it.
     CreateOcclusionMesh(meshHide);
     UpdateOcclusionMesh(offset, pos, rot, s);
 }