public Create ( |
||
broadPhase | ||
body | ||
xf | Box2DX.Common.Transform | |
def | ||
Résultat | void |
/// 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. /// This function automatically updates the mass of the body. /// @param def the fixture definition. /// @warning This function is locked during callbacks. public Fixture CreateFixture(FixtureDef def) { Box2DXDebug.Assert(_world.IsLocked() == false); if (_world.IsLocked() == true) { return null; } BroadPhase broadPhase = _world._contactManager._broadPhase; Fixture fixture = new Fixture(); fixture.Create(broadPhase, this, _xf, def); fixture._next = _fixtureList; _fixtureList = fixture; ++_fixtureCount; fixture.Body = this; bool needMassUpdate = fixture._massData.Mass > 0.0f || fixture._massData.I > 0.0f; // Adjust mass properties if needed. if (needMassUpdate) { ResetMass(); } // 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.WorldFlags.NewFixture; return fixture; }
/// <summary> /// Creates a fixture and attach it to this body. /// @warning This function is locked during callbacks. /// </summary> /// <param name="def">The fixture definition.</param> public Fixture CreateFixture(FixtureDef def) { Box2DXDebug.Assert(_world._lock == false); if (_world._lock == true) { return null; } BroadPhase broadPhase = _world._broadPhase; Fixture fixture = new Fixture(); fixture.Create(broadPhase, this, _xf, def); fixture._next = _fixtureList; _fixtureList = fixture; ++_fixtureCount; fixture._body = this; return fixture; }