Reputation: 21
I just want to change isSensor for my b2Body in some workflow moment.
What i do:
b2Fixture *fixture = currentBody->GetFixtureList();
if (...)
{
fixture->SetSensor(false);
}else
{
fixture->SetSensor(true);
}
But I didn't find any way to Set this fixture to body back. Please advice way to do this. Thanks!
Upvotes: 1
Views: 258
Reputation: 28756
This will set all the fixtures on a body to be sensors. . Once you've done this, you done have to commit it back to the body, the body already has a reference to the fixtures.
-(void) setIsSensor:(bool)isSensor
{
for (b2Fixture *fixture = body->GetFixtureList(); fixture; fixture = fixture->GetNext())
{
fixture->SetSensor(isSensor);
}
}
Upvotes: 1