コード例 #1
0
ファイル: b2Fixture.cs プロジェクト: kingBook/as3_framework
        /**
         * Set if this fixture is a sensor.
         */
        public void SetSensor(bool sensor)
        {
            if (m_isSensor == sensor)
            {
                return;
            }

            m_isSensor = sensor;

            if (m_body == null)
            {
                return;
            }

            b2ContactEdge edge = m_body.GetContactList();

            while (edge != null)
            {
                b2Contact contact  = edge.contact;
                b2Fixture fixtureA = contact.GetFixtureA();
                b2Fixture fixtureB = contact.GetFixtureB();
                if (fixtureA == this || fixtureB == this)
                {
                    contact.SetSensor(fixtureA.IsSensor() || fixtureB.IsSensor());
                }
                edge = edge.next;
            }
        }