Hey, thanks for reply. I'm making android game, that's why I'm trying to avoid creating new objects at runtime.
That's inside my contact listener (executed after contact with player)
Code:
final Fixture x1 = contact.getFixtureA();
if (contact between my player's head fixture and box)
{
x1.getBody().getFixtureList().get(0).getFilterData().maskBits = 0x0001;
// and so on to set rest of shorts
}
But really I can't get how to set those shorts, to make body not collide able with anything (even with the same body type, and that's my main problem now)
// Edit1: I'm stupid, so I will create at beginning Filer object with my bits and than just will set this filter
Code:
Filter f = new Filter();
f.categoryBits =
...
x1.getBody().getFixtureList().get(0).setFilter(f);
But still the problem is how to set those shorts, to prevent from collision with anything (Even same type bodies)
// Edit2: That configuration works if anyone will need it:
Code:
boxBreakFilter = new Filter();
boxBreakFilter.categoryBits = 1;
boxBreakFilter.groupIndex = 2;
boxBreakFilter.maskBits = (short)0;
And than just set this filter on your fixture, and it isn't colliding with anything, even with same body types.
Thanks for help - problem SOLVED.