Box2D.Dynamics.Body.CreateFixture C# (CSharp) Method

CreateFixture() public 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.
public CreateFixture ( FixtureDef def ) : Fixture
def FixtureDef the fixture definition.
return Fixture
        public Fixture CreateFixture(FixtureDef def)
        {
            Debug.Assert(World.Locked == false);

            if (World.Locked == true)
            {
                return null;
            }

            // djm TODO from pool?
            Fixture fixture = new Fixture();
            fixture.Create(this, def);

            if ((Flags & TypeFlags.Active) == TypeFlags.Active)
            {
                BroadPhase broadPhase = World.ContactManager.BroadPhase;
                fixture.CreateProxies(broadPhase, Xf);
            }

            fixture.Next = FixtureList;
            FixtureList = fixture;
            ++FixtureCount;

            fixture.Body = this;

            // Adjust mass properties if needed.
            if (fixture.Density > 0.0f)
            {
                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.NEW_FIXTURE;

            return fixture;
        }

Same methods

Body::CreateFixture ( Shape shape, float density ) : Fixture