Пример #1
0
 public void remCollisionEventReporting(PhysicsActor obj)
 {
     if (IsLocked)
     {
         ActiveRemoveCollisionQueue.Add(obj);
     }
     else
     {
         lock (_collisionEventListLock)
         {
             _collisionEventPrimList.Remove(obj);
             _collisionEventPrimDictionary.Remove(obj.UUID);
         }
     }
 }
Пример #2
0
        /// <summary>
        ///   Called after our prim properties are set Scale, position etc.
        ///   We use this event queue like method to keep changes to the physical scene occuring in the threadlocked mutex
        ///   This assures us that we have no race conditions
        /// </summary>
        /// <param name = "prim"></param>
        public override void AddPhysicsActorTaint(PhysicsActor prim)
        {
            if (prim is AuroraODEPrim)
            {
/* ignore taints for prims
                AuroraODEPrim taintedprim = ((AuroraODEPrim)prim);
                lock (_taintedPrimLock)
                {
                    if (!(_taintedPrimH.Contains(taintedprim)))
                    {
                        //Console.WriteLine("AddPhysicsActorTaint to " +  taintedprim.m_primName);
                        _taintedPrimH.Add(taintedprim);                    // HashSet for searching
                        _taintedPrimL.Add(taintedprim);                    // List for ordered readout
                    }
                }
 */
                return;
            }
            else if (prim is AuroraODECharacter)
            {
                AuroraODECharacter taintedchar = ((AuroraODECharacter) prim);
                lock (_taintedActors)
                {
                    if (!(_taintedActors.Contains(taintedchar)))
                    {
                        _taintedActors.Add(taintedchar);
                        if (taintedchar.bad)
                            MainConsole.Instance.DebugFormat("[PHYSICS]: Added BAD actor {0} to tainted actors", taintedchar.m_uuid);
                    }
                }
            }
        }
Пример #3
0
 private void collision_accounting_events(PhysicsActor p1, PhysicsActor p2, ContactPoint contact)
 {
     if (!p2.SubscribedEvents() && !p1.SubscribedEvents())
         return;
     FireCollisionEvent(p1, p2, contact);
     if (p1.SubscribedEvents())
         p1.AddCollisionEvent(p2.LocalID, contact);
     if (p2.SubscribedEvents())
         p2.AddCollisionEvent(p1.LocalID, contact);
 }
Пример #4
0
        // End recovered. Kitto Flora

        public void addCollisionEventReporting(PhysicsActor obj)
        {
            if (IsLocked)
            {
                ActiveAddCollisionQueue.Add(obj);
            }
            else
            {
                lock (_collisionEventListLock)
                {
                    if (!_collisionEventPrimDictionary.ContainsKey(obj.UUID))
                    {
                        _collisionEventPrimDictionary.Add(obj.UUID, obj);
                        _collisionEventPrimList.Add(obj);
                    }
                }
            }
        }
Пример #5
0
 public override void AddPhysicsActorTaint(PhysicsActor prim)
 {
 }
Пример #6
0
        // Something has collided
        private void SendCollision(uint localID, uint collidingWith, Vector3 collidePoint, Vector3 collideNormal,
                                   float penitration,
                                   out PhysicsActor collider)
        {
            collider = null;
            if (localID == TERRAIN_ID || localID == GROUNDPLANE_ID)
                return; // don't send collisions to the terrain

            ActorTypes type = ActorTypes.Prim;
            if (collidingWith == TERRAIN_ID || collidingWith == GROUNDPLANE_ID)
                type = ActorTypes.Ground;
            else if (m_avatars.ContainsKey(collidingWith))
                type = ActorTypes.Agent;

            BSPrim prim;
            if (m_prims.TryGetValue(localID, out prim))
            {
                collider = prim;
                prim.Collide(collidingWith, type, collidePoint, collideNormal, penitration);
                return;
            }
            BSCharacter actor;
            if (m_avatars.TryGetValue(localID, out actor))
            {
                collider = actor;
                actor.Collide(collidingWith, type, collidePoint, collideNormal, penitration);
                return;
            }
            return;
        }
Пример #7
0
 public abstract void AddPhysicsActorTaint(PhysicsActor prim);
Пример #8
0
        private void AddODECollision(d.ContactGeom curContact, PhysicsActor p1, PhysicsActor p2, IntPtr b1, IntPtr b2, ContactPoint maxDepthContact, ref int NotSkipedCount)
        {
            IntPtr joint = IntPtr.Zero;

            bool p2col = true;

            // We only need to test p2 for 'jump crouch purposes'
            if (p2 is AuroraODECharacter && p1.PhysicsActorType == (int)ActorTypes.Prim)
            {
                // Testing if the collision is at the feet of the avatar
                if ((p2.Position.Z - maxDepthContact.Position.Z) < (p2.Size.Z * 0.6f))
                    p2col = false;
            }

            p2.IsTruelyColliding = true;
            p2.IsColliding = p2col;

            // Logic for collision handling
            // Note, that if *all* contacts are skipped (VolumeDetect)
            // The prim still detects (and forwards) collision events but 
            // appears to be phantom for the world

            // No collision on volume detect prims
            if ((p1 is PhysicsObject && ((PhysicsObject)p1).VolumeDetect) ||
                (p2 is PhysicsObject && ((PhysicsObject)p2).VolumeDetect))
                return;

            if (curContact.depth < 0f)
                return;//Has to be penetrating

            if (m_filterCollisions &&
                checkDupe(curContact, p2.PhysicsActorType))
                return;
            if (m_filterCollisions)
                _perloopContact.Add(curContact);

            NotSkipedCount++;

            // If we're colliding against terrain
            if (p1.PhysicsActorType == (int)ActorTypes.Ground)
            {
                if (p2.PhysicsActorType == (int)ActorTypes.Prim)
                {
                    ((AuroraODEPrim)p2).GetContactParam(p2, ref newGlobalcontact);

                    joint = CreateContacJoint(curContact);
                }
                else
                {
                    newGlobalcontact = new d.Contact();
                    newGlobalcontact.surface.mode |= d.ContactFlags.SoftERP;
                    newGlobalcontact.surface.mu = 75;
                    newGlobalcontact.surface.bounce = 0.1f;
                    newGlobalcontact.surface.soft_erp = 0.05025f;
                    //GetContactParam(0.0f, AvatarContactBounce, ref newGlobalcontact);
                    joint = CreateContacJoint(curContact);
                }
                //Can't collide against anything else, agents do their own ground checks
            }
            else if ((p1.PhysicsActorType == (int)ActorTypes.Agent) &&
                        (p2.PhysicsActorType == (int)ActorTypes.Agent))
            {
                GetContactParam(0.0f, AvatarContactBounce, ref newGlobalcontact);

                joint = CreateContacJoint(curContact);
            }
            else if (p1.PhysicsActorType == (int)ActorTypes.Prim)
            {
                //Add restitution and friction changes
                ((AuroraODEPrim)p1).GetContactParam(p2, ref newGlobalcontact);

                joint = CreateContacJoint(curContact);
            }

            if (m_global_contactcount < m_currentmaxContactsbeforedeath && joint != IntPtr.Zero)
            {
                d.JointAttach(joint, b1, b2);
                m_global_contactcount++;
                joint = IntPtr.Zero;
            }
        }
Пример #9
0
 public override void AddPhysicsActorTaint(PhysicsActor prim)
 {
 }
Пример #10
0
 public abstract void AddPhysicsActorTaint(PhysicsActor prim);
Пример #11
0
 public void FireCollisionEvent(PhysicsActor actor, PhysicsActor collidedActor, ContactPoint contact)
 {
     if (OnCollisionEvent != null)
         OnCollisionEvent(actor, collidedActor, contact);
 }