Example #1
0
		private void body_OnSeparation(Fixture fixtureA, Fixture fixtureB)
		{
			ColEvent e = new ColEvent(ColEvent.EventType.Separation, fixtureA, fixtureB, null);
			if (this.bodyInitState == InitState.Disposing)
				this.ProcessSingleCollisionEvent(e);
			else
				this.eventBuffer.Add(e);
		}
Example #2
0
		private void ProcessSingleCollisionEvent(ColEvent colEvent)
		{
			// Ignore disposed fixtures / bodies
			if (colEvent.FixtureA.Body == null) return;
			if (colEvent.FixtureB.Body == null) return;

			Component otherComponent = colEvent.FixtureB.Body.UserData as Component;
			GameObject otherObject = otherComponent != null ? otherComponent.GameObj : colEvent.FixtureB.Body.UserData as GameObject;

			RigidBodyCollisionEventArgs args = new RigidBodyCollisionEventArgs(
				otherObject,
				colEvent.Data,
				colEvent.FixtureA.UserData as ShapeInfo,
				colEvent.FixtureB.UserData as ShapeInfo);

			if (colEvent.Type == ColEvent.EventType.Collision)
				this.NotifyCollisionBegin(args);
			else if (colEvent.Type == ColEvent.EventType.Separation)
				this.NotifyCollisionEnd(args);
			else if (colEvent.Type == ColEvent.EventType.PostSolve)
				this.NotifyCollisionSolve(args);
		}
Example #3
0
		private bool body_OnCollision(Fixture fixtureA, Fixture fixtureB, Contact contact)
		{
			ColEvent e = new ColEvent(ColEvent.EventType.Collision, fixtureA, fixtureB, null);
			if (this.bodyInitState == InitState.Disposing)
				this.ProcessSingleCollisionEvent(e);
			else
				this.eventBuffer.Add(e);
			return true;
		}