createFixture method
Creates a fixture and attach it to this body. Use this function if you need to set some fixture parameters, like friction. Otherwise you can create the fixture directly from a shape. If the density is non-zero, this function automatically updates the mass of the body. Contacts are not created until the next time step.
Warning: This function is locked during callbacks.
Implementation
Fixture createFixture(FixtureDef def) {
assert(!world.isLocked);
final fixture = Fixture(this, def);
if ((flags & activeFlag) == activeFlag) {
final broadPhase = world.contactManager.broadPhase;
fixture.createProxies(broadPhase, transform);
}
fixtures.add(fixture);
// Adjust mass properties if needed.
if (fixture.density > 0.0) {
resetMassData();
}
// Let the world know we have a new fixture. This will cause new contacts
// to be created at the beginning of the next time step.
world.flags |= World.newFixture;
return fixture;
}