示例#1
0
 public Arbiter(Body b1, Body b2)
 {
     m_body1 = b1;
     m_body2 = b2;
     for (int i = 0; i < MAX_POINTS; i++)
     {
         m_contacts[i] = new Contact();
     }
     m_numContacts = Collide.CollideTest(m_contacts, m_body1, m_body2);
     m_friction    = Mathf.Sqrt(m_body1.m_friction * m_body2.m_friction);
 }
示例#2
0
        void Update()
        {
            debugDraw.Clear();
            ProcessInput();
            contactCount = Collide.CollideTest(contacts, body1, body2);

            debugDraw.DrawBox(body1.m_position, body1.m_size, body1.m_rotation, Color.blue);
            debugDraw.DrawBox(body2.m_position, body2.m_size, body2.m_rotation, Color.blue);
            for (int i = 0; i < contactCount; i++)
            {
                var contact = contacts[i];
                debugDraw.DrawPoint(contact.m_position, Color.red);
            }
        }