DestroyFixture() public method

Destroy a fixture. This removes the fixture from the broad-phase and destroys all contacts associated with this fixture. This will automatically adjust the mass of the body if the body is dynamic and the fixture has positive density. All fixtures attached to a body are implicitly destroyed when the body is destroyed. Warning: This function is locked during callbacks.
public DestroyFixture ( Fixture fixture ) : void
fixture Fixture The fixture to be removed.
return void
Ejemplo n.º 1
0
        private void Decompose()
        {
            //Unsubsribe from the PostSolve delegate
            _world.ContactManager.PostSolve -= PostSolve;

            for (int i = 0; i < Parts.Count; i++)
            {
                Fixture fixture = Parts[i];

                Shape shape = fixture.Shape.Clone();

                MainBody.DestroyFixture(fixture);

                Body body = BodyFactory.CreateBody(_world);
                body.BodyType = BodyType.Dynamic;
                body.Position = MainBody.Position;
                body.Rotation = MainBody.Rotation;

                body.CreateFixture(shape);

                body.AngularVelocity = _angularVelocitiesCache[i];
                body.LinearVelocity  = _velocitiesCache[i];
            }
        }