Exemplo n.º 1
0
 private void ResetPrim (PhysicsObject physicsObject, PhysicsState physicsState, float direction)
 {
     physicsObject.Position = physicsState.Position;
     physicsObject.Orientation = physicsState.Rotation;
     physicsObject.RotationalVelocity = physicsState.AngularVelocity * direction;
     physicsObject.Velocity = physicsState.LinearVelocity * direction;
     physicsObject.ForceSetVelocity (physicsState.LinearVelocity * direction);
     physicsObject.RequestPhysicsterseUpdate ();
 }
Exemplo n.º 2
0
 public void AddPrim (PhysicsObject prm)
 {
     PhysicsState state = new PhysicsState ();
     state.Position = prm.Position;
     state.AngularVelocity = prm.RotationalVelocity;
     state.LinearVelocity = prm.Velocity;
     state.Rotation = prm.Orientation;
     m_activePrims[prm.UUID] = state;
 }
Exemplo n.º 3
0
        private void changelink (AuroraODEPrim newparent)
        {
            // If the newly set parent is not null
            // create link
            if (_parent == null && newparent != null)
            {
                if (newparent.PhysicsActorType == (int)ActorTypes.Prim)
                {
                    AuroraODEPrim obj = (AuroraODEPrim)newparent;
                    obj.ParentPrim (this);
                }
            }
            // If the newly set parent is null
            // destroy link
            else if (_parent != null && newparent == null)
            {
                //Console.WriteLine("  changelink B");

                if (_parent is AuroraODEPrim)
                {
                    AuroraODEPrim obj = (AuroraODEPrim)_parent;
                    obj.ChildDelink (this);
                    childPrim = false;
                    //_parent = null;
                }
            }

            _parent = newparent;
        }
Exemplo n.º 4
0
 public void AddPrim(PhysicsObject prm)
 {
     PhysicsState state = new PhysicsState
                              {
                                  Position = prm.Position,
                                  AngularVelocity = prm.RotationalVelocity,
                                  LinearVelocity = prm.Velocity,
                                  Rotation = prm.Orientation
                              };
     m_activePrims[prm.UUID] = state;
 }
Exemplo n.º 5
0
        public override void RemovePrim(PhysicsObject prim)
        {
            if (prim is AuroraODEPrim)
            {
                if (!IsLocked) //Fix a deadlock situation.. have we been locked by Simulate?
                {
                    lock (OdeLock)
                    {
                        AuroraODEPrim p = (AuroraODEPrim)prim;

                        p.setPrimForRemoval();
                        AddPhysicsActorTaint(prim);
                        //RemovePrimThreadLocked(p);
                    }
                }
                else
                {
                    //Add the prim to a queue which will be removed when Simulate has finished what it's doing.
                    RemoveQueue.Add(prim);
                }
            }
        }
Exemplo n.º 6
0
        public override void RemovePrim(PhysicsObject prim)
        {
            if (prim is BulletDotNETPrim)
            {
                if (!Locked)
                {
                    lock (BulletLock)
                    {
                        BulletDotNETPrim p = (BulletDotNETPrim)prim;

                        p.setPrimForRemoval();
                        AddPhysicsActorTaint(prim);
                    }
                }
                else
                {
                    RemoveQueue.Add(prim);
                }
            }
        }
Exemplo n.º 7
0
        private void changelink (AuroraODEPrim newparent)
        {
            // If the newly set parent is not null
            // create link
            if (_parent == null && newparent != null)
            {
                newparent.ParentPrim (this);
            }
            // If the newly set parent is null
            // destroy link
            else if (_parent != null)
            {
                if (_parent is AuroraODEPrim)
                {
                    if (newparent != _parent)
                    {
                        AuroraODEPrim obj = (AuroraODEPrim)_parent;
                        obj.ChildDelink(this);
                        childPrim = false;

                        if (newparent != null)
                        {
                            newparent.ParentPrim(this);
                        }
                    }
                }
            }

            _parent = newparent;
        }
Exemplo n.º 8
0
    public override void RemovePrim(PhysicsObject prim)
    {
        // m_log.DebugFormat("{0}: RemovePrim", LogHeader);
        if (prim is BSPrim)
            ((BSPrim)prim).Destroy();

        try
        {
            lock (m_prims) m_prims.Remove(prim.LocalID);
        }
        catch (Exception e)
        {
            m_log.WarnFormat("{0}: Attempt to remove prim that is not in physics scene: {1}", LogHeader, e);
        }
    }
Exemplo n.º 9
0
 public override void link(PhysicsObject obj)
 {
     AddChange(AuroraODEPhysicsScene.changes.Link, obj);
 }
Exemplo n.º 10
0
 public override void RemoveAllJointsConnectedToActorThreadLocked(PhysicsObject actor)
 {
     //m_log.Debug("RemoveAllJointsConnectedToActorThreadLocked: start");
     lock (OdeLock)
     {
         //m_log.Debug("RemoveAllJointsConnectedToActorThreadLocked: got lock");
         RemoveAllJointsConnectedToActor(actor);
     }
 }
Exemplo n.º 11
0
 private void RemoveAllJointsConnectedToActor(PhysicsObject actor)
 {
     //m_log.Debug("RemoveAllJointsConnectedToActor: start");
     if (actor.SOPName != null && joints_connecting_actor.ContainsKey(actor.SOPName) && joints_connecting_actor[actor.SOPName] != null)
     {
         foreach (PhysicsJoint j in joints_connecting_actor[actor.SOPName])
         {
             //m_log.Debug("RemoveAllJointsConnectedToActor: about to request deletion of " + j.ObjectNameInScene);
             RequestJointDeletion(j.ObjectNameInScene);
             //m_log.Debug("RemoveAllJointsConnectedToActor: done request deletion of " + j.ObjectNameInScene);
             j.TrackedBodyName = null; // *IMMEDIATELY* prevent any further movement of this joint (else a deleted actor might cause spurious tracking motion of the joint for a few frames, leading to the joint proxy object disappearing)
         }
     }
 }
Exemplo n.º 12
0
 public abstract void RemovePrim(PhysicsObject prim);
Exemplo n.º 13
0
 public override void RemovePrim(PhysicsObject prim)
 {
 }
Exemplo n.º 14
0
 public override void link(PhysicsObject obj)
 {
     m_taintparent = obj;
 }
Exemplo n.º 15
0
 public override void link (PhysicsObject obj)
 {
     AddChange (changes.Link, obj);
 }
Exemplo n.º 16
0
 // link me to the specified parent
 public override void link(PhysicsObject obj) {
     BSPrim parent = (BSPrim)obj;
     // m_log.DebugFormat("{0}: link {1}/{2} to {3}", LogHeader, _avName, _localID, obj.LocalID);
     // TODO: decide if this parent checking needs to happen at taint time
     if (_parentPrim == null)
     {
         if (parent != null)
         {
             // I don't have a parent so I am joining a linkset
             parent.AddChildToLinkset(this);
         }
     }
     else
     {
         // I already have a parent, is parenting changing?
         if (parent != _parentPrim)
         {
             if (parent == null)
             {
                 // we are being removed from a linkset
                 _parentPrim.RemoveChildFromLinkset(this);
             }
             else
             {
                 // asking to reparent a prim should not happen
                 m_log.ErrorFormat("{0}: Reparenting a prim. ", LogHeader);
             }
         }
     }
     return; 
 }
Exemplo n.º 17
0
 public virtual void link(PhysicsObject obj) { }
Exemplo n.º 18
0
 public virtual void RemoveAllJointsConnectedToActorThreadLocked(PhysicsObject actor)
 { return; }