A contact edge is used to connect bodies and contacts together in a contact graph where each body is a node and each contact is an edge. A contact edge belongs to a doubly linked list maintained in each attached body. Each contact has two contact nodes, one for each attached body.
Пример #1
0
 protected internal Contact(IWorldPool argPool)
 {
     FixtureA = null;
     FixtureB = null;
     NodeA = new ContactEdge();
     NodeB = new ContactEdge();
     Manifold = new Manifold();
     Pool = argPool;
 }
Пример #2
0
        public Body(BodyDef bd, World world)
        {
            Debug.Assert(bd.position.Valid);
            Debug.Assert(bd.linearVelocity.Valid);
            Debug.Assert(bd.gravityScale >= 0.0f);
            Debug.Assert(bd.angularDamping >= 0.0f);
            Debug.Assert(bd.linearDamping >= 0.0f);

            m_flags = 0;

            if (bd.bullet)
            {
                m_flags |= e_bulletFlag;
            }
            if (bd.fixedRotation)
            {
                m_flags |= e_fixedRotationFlag;
            }
            if (bd.allowSleep)
            {
                m_flags |= e_autoSleepFlag;
            }
            if (bd.awake)
            {
                m_flags |= e_awakeFlag;
            }
            if (bd.active)
            {
                m_flags |= e_activeFlag;
            }

            m_world = world;

            m_xf.p.set_Renamed(bd.position);
            m_xf.q.set_Renamed(bd.angle);

            m_sweep.localCenter.setZero();
            m_sweep.c0.set_Renamed(m_xf.p);
            m_sweep.c.set_Renamed(m_xf.p);
            m_sweep.a0 = bd.angle;
            m_sweep.a = bd.angle;
            m_sweep.alpha0 = 0.0f;

            m_jointList = null;
            m_contactList = null;
            m_prev = null;
            m_next = null;

            m_linearVelocity.set_Renamed(bd.linearVelocity);
            m_angularVelocity = bd.angularVelocity;

            m_linearDamping = bd.linearDamping;
            m_angularDamping = bd.angularDamping;
            m_gravityScale = bd.gravityScale;

            m_force.setZero();
            m_torque = 0.0f;

            m_sleepTime = 0.0f;

            m_type = bd.type;

            if (m_type == BodyType.DYNAMIC)
            {
                m_mass = 1f;
                m_invMass = 1f;
            }
            else
            {
                m_mass = 0f;
                m_invMass = 0f;
            }

            m_I = 0.0f;
            m_invI = 0.0f;

            m_userData = bd.userData;

            m_fixtureList = null;
            m_fixtureCount = 0;
        }
Пример #3
0
 protected internal Contact(IWorldPool argPool)
 {
     m_fixtureA = null;
     m_fixtureB = null;
     m_nodeA = new ContactEdge();
     m_nodeB = new ContactEdge();
     m_manifold = new Manifold();
     pool = argPool;
 }