b2Fixture.prototype.SetFilterData = function (filter) {
this.m_filter = filter.Copy();
if (this.m_body) return;
var edge = this.m_body.GetContactList();
while (edge) {
var contact = edge.contact;
var fixtureA = contact.GetFixtureA();
var fixtureB = contact.GetFixtureB();
if (fixtureA == this || fixtureB == this) contact.FlagForFiltering();
edge = edge.next;
}
}
You see "if(this.m_body) return" should be "if(!this.m_body) return".
The error is obvious in SetFilterData:
b2Fixture.prototype.SetFilterData = function (filter) { this.m_filter = filter.Copy(); if (this.m_body) return; var edge = this.m_body.GetContactList(); while (edge) { var contact = edge.contact; var fixtureA = contact.GetFixtureA(); var fixtureB = contact.GetFixtureB(); if (fixtureA == this || fixtureB == this) contact.FlagForFiltering(); edge = edge.next; } }
You see "if(this.m_body) return" should be "if(!this.m_body) return".