Пример #1
0
        //----------------------------------------------------------------------------
        //----------------------------------------------------------------------------
        public PhysicsBody(BoundingCollider collider)
        {
            m_collider      = collider;
            m_collider.Body = this;
            LockObject      = new object();

            InitializeThreadSafeVariables();
        }
Пример #2
0
        //----------------------------------------------------------------------------
        //----------------------------------------------------------------------------
        public override bool Contains(BoundingCollider collider)
        {
            float fDistance;

            fDistance = (this.Center - collider.Center).Length();
            float radius  = this.Radius;
            float radius2 = collider.Radius;

            if (radius + radius2 < fDistance)
            {
                return(false);
            }
            if (radius - radius2 < fDistance)
            {
                return(true);
            }
            return(true);
        }
Пример #3
0
 public Sphere(V3 v3Center, float fRadius, PhysicsBody body, BoundingCollider innerCollider) : base(body, innerCollider)
 {
     m_sphere = new BoundingSphere(v3Center, fRadius);
 }
Пример #4
0
 public abstract bool Intersects(BoundingCollider collider);
Пример #5
0
 public abstract bool Contains(BoundingCollider collider);
Пример #6
0
 public BoundingCollider(PhysicsBody body, BoundingCollider innerCollider)
 {
     Body            = body;
     m_innerCollider = innerCollider;
 }
Пример #7
0
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 public override bool Intersects(BoundingCollider collider)
 {
     return(Contains(collider));
 }
Пример #8
0
        //----------------------------------------------------------------------------
        //----------------------------------------------------------------------------
        public override bool Contains(BoundingCollider collider)
        {
            float   num = this.Radius * this.Radius;
            Vector3 vector;

            vector.X = this.Center.X - collider.Min.X;
            vector.Y = this.Center.Y - collider.Max.Y;
            vector.Z = this.Center.Z - collider.Max.Z;
            if (vector.LengthSquared() > num)
            {
                return(true);
            }
            vector.X = this.Center.X - collider.Max.X;
            vector.Y = this.Center.Y - collider.Max.Y;
            vector.Z = this.Center.Z - collider.Max.Z;
            if (vector.LengthSquared() > num)
            {
                return(true);
            }
            vector.X = this.Center.X - collider.Max.X;
            vector.Y = this.Center.Y - collider.Min.Y;
            vector.Z = this.Center.Z - collider.Max.Z;
            if (vector.LengthSquared() > num)
            {
                return(true);
            }
            vector.X = this.Center.X - collider.Min.X;
            vector.Y = this.Center.Y - collider.Min.Y;
            vector.Z = this.Center.Z - collider.Max.Z;
            if (vector.LengthSquared() > num)
            {
                return(true);
            }
            vector.X = this.Center.X - collider.Min.X;
            vector.Y = this.Center.Y - collider.Max.Y;
            vector.Z = this.Center.Z - collider.Min.Z;
            if (vector.LengthSquared() > num)
            {
                return(true);
            }
            vector.X = this.Center.X - collider.Max.X;
            vector.Y = this.Center.Y - collider.Max.Y;
            vector.Z = this.Center.Z - collider.Min.Z;
            if (vector.LengthSquared() > num)
            {
                return(true);
            }
            vector.X = this.Center.X - collider.Max.X;
            vector.Y = this.Center.Y - collider.Min.Y;
            vector.Z = this.Center.Z - collider.Min.Z;
            if (vector.LengthSquared() > num)
            {
                return(true);
            }
            vector.X = this.Center.X - collider.Min.X;
            vector.Y = this.Center.Y - collider.Min.Y;
            vector.Z = this.Center.Z - collider.Min.Z;
            if (vector.LengthSquared() > num)
            {
                return(true);
            }
            return(true);
        }
Пример #9
0
 public Box(V3 v3Min, V3 v3Max, PhysicsBody body, BoundingCollider coliider) : base(body, coliider)
 {
     m_box = new BoundingBox(v3Min, v3Max);
 }
Пример #10
0
 public CollisionPair(BoundingCollider colliderOne, BoundingCollider colliderTwo)
 {
     m_colliderOne = colliderOne;
     m_colliderTwo = colliderTwo;
 }
Пример #11
0
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 public void RemoveColliderSim(BoundingCollider collider)
 {
     lock (m_colliderLock)
         m_collisionsBroadList.Remove(collider);
 }
Пример #12
0
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 public void AddColliderSim(BoundingCollider collider)
 {
     lock (m_colliderLock)
         m_collisionsBroadList.Add(collider);
 }