Example #1
0
            public override void OnContactNotify(ContactPair contactInformation, ContactPairFlag events)
            {
                ContactStreamIterator iter;

                using (iter = new ContactStreamIterator(contactInformation.ContactStream))
                {
                    while (iter.GoToNextPair())
                    {
                        while (iter.GoToNextPatch())
                        {
                            while (iter.GoToNextPoint())
                            {
                                // Test each of the available 'information' functions/properties

                                int       numberOfPairs            = iter.GetNumberOfPairs();
                                Shape     shapeA                   = iter.GetShapeA();
                                Shape     shapeB                   = iter.GetShapeB();
                                bool      isShapeADeleted          = iter.IsDeletedShapeA();
                                bool      isShapeBDeleted          = iter.IsDeletedShapeB();
                                ShapeFlag shapeFlags               = iter.GetShapeFlags();
                                int       numberOfPatches          = iter.GetNumberOfPatches();
                                int       numberOfPatchesRemaining = iter.GetNumberOfPatchesRemaining();
                                Vector3   patchNormal              = iter.GetPatchNormal();
                                int       numberOfPoints           = iter.GetNumberOfPoints();
                                int       numberOfPointsRemaining  = iter.GetNumberOfPointsRemaining();
                                Vector3   point            = iter.GetPoint();
                                float     separation       = iter.GetSeperation();
                                int       featureIndex0    = iter.GetFeatureIndex0();
                                int       featureIndex1    = iter.GetFeatureIndex1();
                                float     pointNormalForce = iter.GetPointNormalForce();

                                // First collision should be AB
                                if (IsPairContacting(shapeA, A, B) && IsPairContacting(shapeB, A, B))
                                {
                                    ABHitCallback();
                                }

                                // Second collision should be BC, but only if AB has happened
                                if (IsPairContacting(shapeA, B, C) && IsPairContacting(shapeB, B, C))
                                {
                                    BCHitCallback();
                                }
                            }
                        }
                    }
                }

                Assert.IsTrue(iter.IsDisposed);
            }
Example #2
0
			public override void OnContactNotify( ContactPair contactInformation, ContactPairFlag events )
			{
				ContactStreamIterator iter;
				using( iter = new ContactStreamIterator( contactInformation.ContactStream ) )
				{
					while( iter.GoToNextPair() )
					{
						while( iter.GoToNextPatch() )
						{
							while( iter.GoToNextPoint() )
							{
								// Test each of the available 'information' functions/properties

								int numberOfPairs = iter.GetNumberOfPairs();
								Shape shapeA = iter.GetShapeA();
								Shape shapeB = iter.GetShapeB();
								bool isShapeADeleted = iter.IsDeletedShapeA();
								bool isShapeBDeleted = iter.IsDeletedShapeB();
								ShapeFlag shapeFlags = iter.GetShapeFlags();
								int numberOfPatches = iter.GetNumberOfPatches();
								int numberOfPatchesRemaining = iter.GetNumberOfPatchesRemaining();
								Vector3 patchNormal = iter.GetPatchNormal();
								int numberOfPoints = iter.GetNumberOfPoints();
								int numberOfPointsRemaining = iter.GetNumberOfPointsRemaining();
								Vector3 point = iter.GetPoint();
								float separation = iter.GetSeperation();
								int featureIndex0 = iter.GetFeatureIndex0();
								int featureIndex1 = iter.GetFeatureIndex1();
								float pointNormalForce = iter.GetPointNormalForce();

								// First collision should be AB
								if( IsPairContacting( shapeA, A, B ) && IsPairContacting( shapeB, A, B ) )
								{
									ABHitCallback();
								}

								// Second collision should be BC, but only if AB has happened
								if( IsPairContacting( shapeA, B, C ) && IsPairContacting( shapeB, B, C ) )
								{
									BCHitCallback();
								}
							}
						}
					}
				}

				Assert.IsTrue( iter.IsDisposed );
			}