FarseerPhysics.Dynamics.Contacts.Contact.destroy C# (CSharp) Method

destroy() private method

private destroy ( ) : void
return void
		internal void destroy()
		{
#if USE_ACTIVE_CONTACT_SET
            FixtureA.Body.World.ContactManager.RemoveActiveContact(this);
#endif
			fixtureA.body._world._contactPool.Enqueue( this );

			if( manifold.pointCount > 0 && fixtureA.isSensor == false && fixtureB.isSensor == false )
			{
				fixtureA.body.isAwake = true;
				fixtureB.body.isAwake = true;
			}

			reset( null, 0, null, 0 );
		}

Usage Example

Beispiel #1
0
		internal void destroy( Contact contact )
		{
			var fixtureA = contact.fixtureA;
			var fixtureB = contact.fixtureB;
			var bodyA = fixtureA.body;
			var bodyB = fixtureB.body;

			if( contact.isTouching )
			{
				//Report the separation to both participants:
				if( fixtureA != null && fixtureA.onSeparation != null )
					fixtureA.onSeparation( fixtureA, fixtureB );

				//Reverse the order of the reported fixtures. The first fixture is always the one that the
				//user subscribed to.
				if( fixtureB != null && fixtureB.onSeparation != null )
					fixtureB.onSeparation( fixtureB, fixtureA );

				if( onEndContact != null )
					onEndContact( contact );
			}

			// Remove from the world.
			contactList.Remove( contact );

			// Remove from body 1
			if( contact._nodeA.prev != null )
				contact._nodeA.prev.next = contact._nodeA.next;

			if( contact._nodeA.next != null )
				contact._nodeA.next.prev = contact._nodeA.prev;

			if( contact._nodeA == bodyA.contactList )
				bodyA.contactList = contact._nodeA.next;

			// Remove from body 2
			if( contact._nodeB.prev != null )
				contact._nodeB.prev.next = contact._nodeB.next;

			if( contact._nodeB.next != null )
				contact._nodeB.next.prev = contact._nodeB.prev;

			if( contact._nodeB == bodyB.contactList )
				bodyB.contactList = contact._nodeB.next;

#if USE_ACTIVE_CONTACT_SET
			if (ActiveContacts.Contains(contact))
			{
				ActiveContacts.Remove(contact);
			}
#endif
			contact.destroy();
		}