コード例 #1
0
        public void Execute(PhysxScene scene)
        {
            if (_newPrimaryShape == null)
            {
                if (_actor.Disposed)
                {
                    return;
                }

                _actor.BeginDelayCommands(this);

                Meshing.RemeshActorWorker worker = new Meshing.RemeshActorWorker(scene, _actor, _vdActive || _actor.IsPhysical,
                                                                                 (PhysicsShape rootShape, Dictionary <PhysxPrim, RelatedShapes> childShapes) =>
                {
                    _newPrimaryShape = rootShape;
                    _newChildShapes  = childShapes;

                    scene.QueueCommand(this);
                });

                worker.Remesh();
            }
            else
            {
                try
                {
                    if (_actor.IsPhysical)
                    {
                        if (!_actor.DynamicsPrecheck(_newPrimaryShape, _newChildShapes))
                        {
                            return;
                        }
                    }

                    _actor.RebuildPhysxActorWithNewShape(_newPrimaryShape, _newChildShapes, _vdActive ? false : _actor.IsPhysical, false);
                    _actor.SetVolumeDetectSync(_vdActive);
                }
                finally
                {
                    _actor.EndDelayCommands();
                }
            }
        }