Exemplo n.º 1
0
        protected static ColliderSliceResult PrepareSliceCollider(Collider collider, Mesh mesh, Plane plane)
        {
            var                   result        = new ColliderSliceResult();
            IBzSliceAdapter       adapter       = new BzSliceColliderAdapter(mesh.vertices, collider.gameObject);
            SliceConfigurationDto conf          = BzSliceConfiguration.GetDefault();
            BzMeshDataDissector   meshDissector = new BzMeshDataDissector(mesh, plane, null, adapter, conf);

            result.SliceResult      = SliceResult.Sliced;
            result.OriginalCollider = collider;
            result.meshDissector    = meshDissector;

            return(result);
        }
Exemplo n.º 2
0
        public BzMeshDataDissector(Mesh mesh, Plane plane, Material[] materials, IBzSliceAdapter adapter, SliceConfigurationDto configuration)
        {
            _adapter      = adapter;
            _plane        = plane;
            Configuration = configuration;

            _meshDataNeg = new BzMeshData(mesh, materials);
            _meshDataPos = new BzMeshData(mesh, materials);

            _subMeshes = new int[mesh.subMeshCount][];
            for (int subMeshIndex = 0; subMeshIndex < mesh.subMeshCount; ++subMeshIndex)
            {
                _subMeshes[subMeshIndex] = mesh.GetTriangles(subMeshIndex);
            }
        }