Esempio n. 1
0
        public static bool shouldCollide(Fixture fixtureA, Fixture fixtureB)
        {
            if (Settings.useFPECollisionCategories)
            {
                if ((fixtureA.collisionGroup == fixtureB.collisionGroup) && fixtureA.collisionGroup != 0 && fixtureB.collisionGroup != 0)
                {
                    return(false);
                }

                if (((fixtureA.collisionCategories & fixtureB.collidesWith) == Category.None) &
                    ((fixtureB.collisionCategories & fixtureA.collidesWith) == Category.None))
                {
                    return(false);
                }

                if (fixtureA.isFixtureIgnored(fixtureB) || fixtureB.isFixtureIgnored(fixtureA))
                {
                    return(false);
                }

                return(true);
            }

            if (fixtureA.collisionGroup == fixtureB.collisionGroup && fixtureA.collisionGroup != 0)
            {
                return(fixtureA.collisionGroup > 0);
            }

            bool collide = (fixtureA.collidesWith & fixtureB.collisionCategories) != 0 &&
                           (fixtureA.collisionCategories & fixtureB.collidesWith) != 0;

            if (collide)
            {
                if (fixtureA.isFixtureIgnored(fixtureB) || fixtureB.isFixtureIgnored(fixtureA))
                {
                    return(false);
                }
            }

            return(collide);
        }
Esempio n. 2
0
		public static bool shouldCollide( Fixture fixtureA, Fixture fixtureB )
		{
			if( Settings.useFPECollisionCategories )
			{
				if( ( fixtureA.collisionGroup == fixtureB.collisionGroup ) && fixtureA.collisionGroup != 0 && fixtureB.collisionGroup != 0 )
					return false;

				if( ( ( fixtureA.collisionCategories & fixtureB.collidesWith ) == Category.None ) &
					( ( fixtureB.collisionCategories & fixtureA.collidesWith ) == Category.None ) )
					return false;

				if( fixtureA.isFixtureIgnored( fixtureB ) || fixtureB.isFixtureIgnored( fixtureA ) )
					return false;

				return true;
			}

			if( fixtureA.collisionGroup == fixtureB.collisionGroup && fixtureA.collisionGroup != 0 )
				return fixtureA.collisionGroup > 0;

			bool collide = ( fixtureA.collidesWith & fixtureB.collisionCategories ) != 0 &&
						   ( fixtureA.collisionCategories & fixtureB.collidesWith ) != 0;

			if( collide )
			{
				if( fixtureA.isFixtureIgnored( fixtureB ) || fixtureB.isFixtureIgnored( fixtureA ) )
					return false;
			}

			return collide;
		}