| 609 | } |
| 610 | |
| 611 | func (body *B2Body) CreateFixtureFromDef(def *B2FixtureDef) *B2Fixture { |
| 612 | |
| 613 | B2Assert(body.M_world.IsLocked() == false) |
| 614 | if body.M_world.IsLocked() == true { |
| 615 | return nil |
| 616 | } |
| 617 | |
| 618 | fixture := NewB2Fixture() |
| 619 | fixture.Create(body, def) |
| 620 | |
| 621 | if (body.M_flags & B2Body_Flags.E_activeFlag) != 0x0000 { |
| 622 | broadPhase := &body.M_world.M_contactManager.M_broadPhase |
| 623 | fixture.CreateProxies(broadPhase, body.M_xf) |
| 624 | } |
| 625 | |
| 626 | fixture.M_next = body.M_fixtureList |
| 627 | body.M_fixtureList = fixture |
| 628 | body.M_fixtureCount++ |
| 629 | |
| 630 | fixture.M_body = body |
| 631 | |
| 632 | // Adjust mass properties if needed. |
| 633 | if fixture.M_density > 0.0 { |
| 634 | body.ResetMassData() |
| 635 | } |
| 636 | |
| 637 | // Let the world know we have a new fixture. This will cause new contacts |
| 638 | // to be created at the beginning of the next time step. |
| 639 | body.M_world.M_flags |= B2World_Flags.E_newFixture |
| 640 | |
| 641 | return fixture |
| 642 | } |
| 643 | |
| 644 | func (body *B2Body) CreateFixture(shape B2ShapeInterface, density float64) *B2Fixture { |
| 645 | |