public override void RemoveAvatar(PhysicsCharacter actor)
 {
     BasicCharacterActor act = (BasicCharacterActor)actor;
     if (_actors.Contains(act))
     {
         _actors.Remove(act);
     }
 }
 public void AddAvatar (PhysicsCharacter 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;
 }
 private void ResetAvatar (PhysicsCharacter physicsObject, PhysicsState physicsState, float direction)
 {
     physicsObject.Position = physicsState.Position;
     physicsObject.ForceSetPosition (physicsState.Position);
     physicsObject.Orientation = physicsState.Rotation;
     physicsObject.RotationalVelocity = physicsState.AngularVelocity * direction;
     physicsObject.Velocity = physicsState.LinearVelocity * direction;
     physicsObject.ForceSetVelocity (physicsState.LinearVelocity * direction);
     physicsObject.RequestPhysicsterseUpdate ();
 }
Example #4
0
        public override void RemoveAvatar(PhysicsCharacter actor)
        {
            //m_log.Debug("[PHYSICS]:ODELOCK");
            ((AuroraODECharacter)actor).Destroy();

        }
 public override void RemoveAvatar(PhysicsCharacter actor)
 {
     //MainConsole.Instance.Debug("[PHYSICS]:ODELOCK");
     ((AuroraODECharacter) actor).Destroy();
 }
Example #6
0
 /// <summary>
 /// Removes physics plugin scene representation of this agent if it exists.
 /// </summary>
 public virtual void RemoveFromPhysicalScene ()
 {
     try
     {
         if (PhysicsActor != null)
         {
             if (OnRemovePhysics != null)
                 OnRemovePhysics();
             if (m_physicsActor != null)
                 m_scene.PhysicsScene.RemoveAvatar(m_physicsActor);
             if (m_physicsActor != null)
                 m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
             if (m_physicsActor != null)
                 m_physicsActor.OnRequestTerseUpdate -= SendPhysicsTerseUpdateToAllClients;
             if (m_physicsActor != null)
                 m_physicsActor.OnSignificantMovement -= CheckForSignificantMovement;
             if (m_physicsActor != null)
                 m_physicsActor.OnPositionAndVelocityUpdate -= PhysicsUpdatePosAndVelocity;
             if (m_physicsActor != null)
                 m_physicsActor.OnCheckForRegionCrossing -= CheckForBorderCrossing;
             if (m_physicsActor != null)
                 m_physicsActor.OnOutOfBounds -= OutOfBoundsCall;
             if (m_physicsActor != null)
                 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
             if (m_physicsActor != null)
                 m_physicsActor.UnSubscribeEvents();
             m_physicsActor = null;
         }
     }
     catch { }
 }
Example #7
0
        /// <summary>
        /// Adds a physical representation of the avatar to the Physics plugin
        /// </summary>
        public virtual void AddToPhysicalScene (bool isFlying, bool AddAvHeightToPosition)
        {
            //Make sure we arn't already doing this
            if (m_creatingPhysicalRepresentation)
                return;

            //Set this so we don't do it multiple times
            m_creatingPhysicalRepresentation = true;

            IAvatarAppearanceModule appearance = RequestModuleInterface<IAvatarAppearanceModule> ();
            if (appearance != null)
            {
                if (appearance.Appearance.AvatarHeight == 0)
                    appearance.Appearance.SetHeight ();

                if (appearance.Appearance.AvatarHeight != 0)
                    m_avHeight = appearance.Appearance.AvatarHeight;
            }

            PhysicsScene scene = m_scene.PhysicsScene;

            Vector3 pVec = AbsolutePosition;

            if(AddAvHeightToPosition) //This is here so that after teleports, you arrive just slightly higher so that you don't fall through the ground/objects
                pVec.Z += m_avHeight;

            m_physicsActor = scene.AddAvatar(Name, pVec, Rotation,
                                                 new Vector3 (0f, 0f, m_avHeight), isFlying, LocalId, UUID);

            scene.AddPhysicsActorTaint(m_physicsActor);
            m_physicsActor.OnRequestTerseUpdate += SendPhysicsTerseUpdateToAllClients;
            m_physicsActor.OnSignificantMovement += CheckForSignificantMovement;
            m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
            m_physicsActor.OnPositionAndVelocityUpdate += PhysicsUpdatePosAndVelocity;
            m_physicsActor.OnCheckForRegionCrossing += CheckForBorderCrossing;

            m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
            m_physicsActor.SubscribeEvents(500);
            m_physicsActor.Orientation = Rotation;

            //Tell any events about it
            if (OnAddPhysics != null)
                OnAddPhysics();

            //All done, reset this
            m_creatingPhysicalRepresentation = false;
        }
        public override void RemoveAvatar(PhysicsCharacter actor)
        {
            lock (BulletLock)
            {
                BulletDotNETCharacter chr = (BulletDotNETCharacter)actor;

                if (!Locked)
                {
                    chr.Remove();
                    AddPhysicsActorTaint(chr);
                    //chr = null;
                }
                else
                {
                    RemoveQueue.Add(actor);
                }
                m_charactersLocalID.Remove(chr.m_localID);
            }
        }
Example #9
0
    public override void RemoveAvatar(PhysicsCharacter actor)
    {
        // m_log.DebugFormat("{0}: RemoveAvatar", LogHeader);
        if (actor is BSCharacter)
            ((BSCharacter)actor).Destroy();

        try
        {
            lock (m_avatars) m_avatars.Remove(actor.LocalID);
        }
        catch (Exception e)
        {
            m_log.WarnFormat("{0}: Attempt to remove avatar that is not in physics scene: {1}", LogHeader, e);
        }
    }
Example #10
0
 public abstract void RemoveAvatar(PhysicsCharacter actor);
Example #11
0
 public override void RemoveAvatar (PhysicsCharacter actor)
 {
 }