Exemplo n.º 1
0
        internal void LinkPrimAsChildSync(/*PhysicsShape childShape, */ BasicPrim newChild, OpenMetaverse.Vector3 localPos, OpenMetaverse.Quaternion localRot,
                                          bool delayInertiaRecalc)
        {
            newChild.ChangeToChild(this, localPos, localRot);

            this.CombineChildShape(/*childShape, */ newChild, localPos, localRot, delayInertiaRecalc);
        }
Exemplo n.º 2
0
        public override void LinkToNewParent(PhysicsActor obj, OpenMetaverse.Vector3 localPos, OpenMetaverse.Quaternion localRot)
        {
            lock (_terseConsistencyLock)
            {
                _position = localPos;
                _rotation = localRot;
            }

            _parentPrim = (BasicPrim)obj;
        }
Exemplo n.º 3
0
        public override void DelinkFromParent(OpenMetaverse.Vector3 newWorldPosition, OpenMetaverse.Quaternion newWorldRotation)
        {
            lock (_terseConsistencyLock)
            {
                _position = newWorldPosition;
                _rotation = newWorldRotation;
            }

            _parentPrim = null;
        }
Exemplo n.º 4
0
        public override void BulkAddPrimShapes(ICollection<BulkShapeData> shapeData, AddPrimShapeFlags flags)
        {
            // Called on restore of objects when region boots up.  Other times as well, but that's the critical.
            AddPrimShapeFlags _flags = flags;
            ICollection<BulkShapeData> _shapes = shapeData;
            int _totalNumShapes = _shapes.Count;

            bool _rootHasVdSet = false;
            bool isPhysical = (_flags & PhysicsScene.AddPrimShapeFlags.Physical) != 0;

            //we have all the shapes for the parent and all children, time to construct the group
            bool first = true;
            BasicPrim rootPrim = null;

            //CollisionGroupFlag collisionGroup = (_flags & PhysicsScene.AddPrimShapeFlags.Phantom) == 0 ? CollisionGroupFlag.Normal : CollisionGroupFlag.PhysicalPhantom;
            foreach (BulkShapeData shape in _shapes)
            {
                if (first)
                {
                    BasicPhysicsProperties properties = BasicPhysicsProperties.DeserializeOrCreateNew(this, shape.Material, shape.PhysicsProperties);
                    _rootHasVdSet = properties.VolumeDetectActive;

                    if (_rootHasVdSet)
                    {
                        isPhysical = false;
                    }

                    rootPrim = new BasicPrim(this, shape.Pbs, shape.Position, shape.Rotation, /*_newPrimaryShape, actor, */
                        isPhysical, properties/*, collisionGroup*/);

                    shape.OutActor = rootPrim;

                    first = false;
                }
                else
                {
                    BasicPhysicsProperties properties = BasicPhysicsProperties.DeserializeOrCreateNew(this, shape.Material, shape.PhysicsProperties);

                    BasicPrim childPrim = new BasicPrim(rootPrim, this, shape.Pbs, shape.Position, shape.Rotation, /*phyShape, 
                        null,*/ isPhysical, properties/*, collisionGroup*/);
                    rootPrim.LinkPrimAsChildSync(/*phyShape, */childPrim, shape.Position, shape.Rotation, true);

                    shape.OutActor = childPrim;
                }
            }
        }
Exemplo n.º 5
0
        private void ChangeToChild(BasicPrim parent, OpenMetaverse.Vector3 localPos, OpenMetaverse.Quaternion localRot)
        {
            _parentPrim = parent;

            //this prim no longer has its old shape or its actor
            //_scene.PrimBecameChild(this);

            //if we have children, we need to unref their shapes here, as our new parent (ours and our children)
            //may require different shape types and will be rebuilt
            //this.DeleteActor(_actor, _myShape, _isPhysical, DeleteActorFlags.UnrefChildShapes);

            //_actor = null;
            //_dynActor = null;
            //_myShape = null;

            _position = localPos;
            _rotation = localRot;
        }
Exemplo n.º 6
0
        public BasicPrim(BasicPrim parent, BasicScene scene, PrimitiveBaseShape baseShape, OpenMetaverse.Vector3 pos,
                         OpenMetaverse.Quaternion rotation, /*PhysicsShape myShape, PhysX.RigidActor myActor,*/
                         bool isPhysical, IPhysicsProperties properties /*, CollisionGroupFlag collisionGroup*/)
        {
            _parentPrim = parent;
            _scene      = scene;
            _pbs        = baseShape;
            _position   = pos;
            _rotation   = rotation;
            _isPhysical = isPhysical;
            _properties = (BasicPhysicsProperties)properties;
            //_collisionGroup = collisionGroup;

            _acceleration = OpenMetaverse.Vector3.Zero;

            _mass = OBJECT_DENSITY * _pbs.Scale.X * _pbs.Scale.Y * _pbs.Scale.Z;

            //this.AssignActor(myActor, myShape, _isPhysical, DeleteActorFlags.None);
        }
Exemplo n.º 7
0
 private void CombineChildShape(/*PhysicsShape childShape, */ BasicPrim newChild, OpenMetaverse.Vector3 localPos, OpenMetaverse.Quaternion localRot,
                                bool delayInertiaRecalc)
 {
     newChild._isPhysical = _isPhysical;
 }
Exemplo n.º 8
0
        public BasicPrim(BasicPrim parent, BasicScene scene, PrimitiveBaseShape baseShape, OpenMetaverse.Vector3 pos,
            OpenMetaverse.Quaternion rotation, /*PhysicsShape myShape, PhysX.RigidActor myActor,*/
            bool isPhysical, IPhysicsProperties properties/*, CollisionGroupFlag collisionGroup*/)
        {
            _parentPrim = parent;
            _scene = scene;
            _pbs = baseShape;
            _position = pos;
            _rotation = rotation;
            _isPhysical = isPhysical;
            _properties = (BasicPhysicsProperties)properties;
            //_collisionGroup = collisionGroup;

            _acceleration = OpenMetaverse.Vector3.Zero;

            _mass = OBJECT_DENSITY * _pbs.Scale.X * _pbs.Scale.Y * _pbs.Scale.Z;

            //this.AssignActor(myActor, myShape, _isPhysical, DeleteActorFlags.None);
        }
Exemplo n.º 9
0
 private void CombineChildShape(/*PhysicsShape childShape, */BasicPrim newChild, OpenMetaverse.Vector3 localPos, OpenMetaverse.Quaternion localRot, 
     bool delayInertiaRecalc)
 {
     newChild._isPhysical = _isPhysical;
 }
Exemplo n.º 10
0
        internal void LinkPrimAsChildSync(/*PhysicsShape childShape, */BasicPrim newChild, OpenMetaverse.Vector3 localPos, OpenMetaverse.Quaternion localRot, 
            bool delayInertiaRecalc)
        {
            newChild.ChangeToChild(this, localPos, localRot);

            this.CombineChildShape(/*childShape, */newChild, localPos, localRot, delayInertiaRecalc);
        }
Exemplo n.º 11
0
        private void ChangeToChild(BasicPrim parent, OpenMetaverse.Vector3 localPos, OpenMetaverse.Quaternion localRot)
        {
            _parentPrim = parent;

            //this prim no longer has its old shape or its actor
            //_scene.PrimBecameChild(this);

            //if we have children, we need to unref their shapes here, as our new parent (ours and our children)
            //may require different shape types and will be rebuilt
            //this.DeleteActor(_actor, _myShape, _isPhysical, DeleteActorFlags.UnrefChildShapes);

            //_actor = null;
            //_dynActor = null;
            //_myShape = null;

            _position = localPos;
            _rotation = localRot;
        }
Exemplo n.º 12
0
        public override void DelinkFromParent(OpenMetaverse.Vector3 newWorldPosition, OpenMetaverse.Quaternion newWorldRotation)
        {
            lock (_terseConsistencyLock)
            {
                _position = newWorldPosition;
                _rotation = newWorldRotation;
            }

            _parentPrim = null;
        }
Exemplo n.º 13
0
        public override void LinkToNewParent(PhysicsActor obj, OpenMetaverse.Vector3 localPos, OpenMetaverse.Quaternion localRot)
        {
            lock (_terseConsistencyLock)
            {
                _position = localPos;
                _rotation = localRot;
            }

            _parentPrim = (BasicPrim)obj;
        }