There's a small error in b2Fixture.SetFilterData()
Original code:
This line...
if (m_body) return;
Should read...
if (!m_body) return;
This bug is preventing the fixture from being refiltered when filter data has changed.
The corrected code here:
Original code:
Code:
public function SetFilterData(filter:b2FilterData):void
{
m_filter = filter.Copy();
if (m_body)
return;
var edge:b2ContactEdge = m_body.GetContactList();
while (edge)
{
var contact:b2Contact = edge.contact;
var fixtureA:b2Fixture = contact.GetFixtureA();
var fixtureB:b2Fixture = contact.GetFixtureB();
if (fixtureA == this || fixtureB == this)
contact.FlagForFiltering();
edge = edge.next;
}
}
{
m_filter = filter.Copy();
if (m_body)
return;
var edge:b2ContactEdge = m_body.GetContactList();
while (edge)
{
var contact:b2Contact = edge.contact;
var fixtureA:b2Fixture = contact.GetFixtureA();
var fixtureB:b2Fixture = contact.GetFixtureB();
if (fixtureA == this || fixtureB == this)
contact.FlagForFiltering();
edge = edge.next;
}
}
This line...
if (m_body) return;
Should read...
if (!m_body) return;
This bug is preventing the fixture from being refiltered when filter data has changed.
The corrected code here:
Code:
public function SetFilterData(filter:b2FilterData):void
{
m_filter = filter.Copy();
if (!m_body)
return;
var edge:b2ContactEdge = m_body.GetContactList();
while (edge)
{
var contact:b2Contact = edge.contact;
var fixtureA:b2Fixture = contact.GetFixtureA();
var fixtureB:b2Fixture = contact.GetFixtureB();
if (fixtureA == this || fixtureB == this)
contact.FlagForFiltering();
edge = edge.next;
}
}
{
m_filter = filter.Copy();
if (!m_body)
return;
var edge:b2ContactEdge = m_body.GetContactList();
while (edge)
{
var contact:b2Contact = edge.contact;
var fixtureA:b2Fixture = contact.GetFixtureA();
var fixtureB:b2Fixture = contact.GetFixtureB();
if (fixtureA == this || fixtureB == this)
contact.FlagForFiltering();
edge = edge.next;
}
}