Setting collision filter in 2.1.x

Hello,

I have been looking at the manual and the source to see how to set the collision filtering for 2.1.x.

FixtureDef.filter.groupIndex = -1;

Next I would SetFilterData, but from the manual, I'm not clear how that is done.

"Sometimes you might need to change collision filtering after a fixture has already been created. You can get and set the b2Filter structure on an existing fixture using b2Fixture::GetFilterData and b2Fixture::SetFilterData."

Ok, but b2Fixture is protected.. oh wait you mean b2Fixture* fixture??

It's not made clear to me how to SetFilterData from here..

Thanks.
Code:
b2Filter filter = myFixture->GetFilterData();
filter.groupIndex = -1;
myFixture->SetFilterData(filter);


Why is this confusing?
Ah, it confused me because I was ignoring the b2Fixture* returned by Body->CreateFixture(&FixtureDef) which is of course how you access the SetFilterData(b2Filter) function.

Thanks.
You can also follow a linked list of fixtures on a body using GetFixtureList.

Original thread: https://box2d.org/forum/viewtopic.php?t=4831