public void Execute(PhysxScene scene) { if (Shape == null) { PhysicsProperties properties = PhysicsProperties.DeserializeOrCreateNew(scene, _material, _serializedPhysicsProperties); _hasVdSet = properties.VolumeDetectActive; scene.MeshingStageImpl.QueueForMeshing(_primName, _pbs, _size, _lod, (_flags& PhysicsScene.AddPrimShapeFlags.Physical) != 0 || _hasVdSet, _serializedPhysicsShapes, (_flags& PhysxScene.AddPrimShapeFlags.FromCrossing) == PhysicsScene.AddPrimShapeFlags.FromCrossing, delegate(PhysicsShape meshedShape) { Shape = meshedShape; scene.QueueCommand(this); } ); } else { bool isPhysical = (_flags & PhysicsScene.AddPrimShapeFlags.Physical) != 0; if (_hasVdSet) { isPhysical = false; } CollisionGroupFlag collisionGroup = (_flags & PhysicsScene.AddPrimShapeFlags.Phantom) == 0 ? CollisionGroupFlag.Normal : CollisionGroupFlag.PhysicalPhantom; if (_parent == null) { bool kinematicStatic; PhysicsProperties properties = PhysicsProperties.DeserializeOrCreateNew(scene, _material, _serializedPhysicsProperties); Actor = PhysxActorFactory.CreateProperInitialActor(Shape, scene, _position, _rotation, _flags, out kinematicStatic, properties.PhysxMaterial); FinalPrim = new PhysxPrim(scene, _pbs, _position, _rotation, Shape, Actor, isPhysical, properties, collisionGroup); scene.AddPrimSync(FinalPrim, isPhysical, kinematicStatic); } else { PhysicsProperties properties = PhysicsProperties.DeserializeOrCreateNew(scene, _material, _serializedPhysicsProperties); FinalPrim = new PhysxPrim(_parent, scene, _pbs, _position, _rotation, Shape, null, isPhysical, properties, collisionGroup); _parent.LinkPrimAsChildSync(Shape, FinalPrim, _position, _rotation, false); } if (_hasVdSet) { FinalPrim.SetVolumeDetectSync(true); } if ((_flags & PhysicsScene.AddPrimShapeFlags.StartSuspended) != 0) { FinalPrim.SuspendPhysicsSync(_interpolateTime); } FinalPrim.DynamicsPostcheck(); FinalPrim.SetInitialVelocities(_velocity, _angularVelocity); if ((_flags & PhysicsScene.AddPrimShapeFlags.Interpolate) != 0) { FinalPrim.SuspendPhysicsSync(_interpolateTime); FinalPrim.ResumePhysicsSync(true); } this.FinshedEvent.Set(); } }