Ejemplo n.º 1
0
        public CollisionDispatcher(ICollisionConfiguration collisionConfiguration)
        {
            m_dispatcherFlags = DispatcherFlags.CD_USE_RELATIVE_CONTACT_BREAKING_THRESHOLD;
            m_collisionConfiguration = collisionConfiguration;
            m_neerCallback = DefaultNearCallback;

#if false
            m_collisionAlgorithmPoolAllocator = collisionConfiguration.getCollisionAlgorithmPool();
            m_persistentManifoldPoolAllocator = collisionConfiguration.getPersistentManifoldPool();
#endif
            m_doubleDispatch = new CollisionAlgorithmCreateFunc[(int)BroadphaseNativeTypes.MAX_BROADPHASE_COLLISION_TYPES, (int)BroadphaseNativeTypes.MAX_BROADPHASE_COLLISION_TYPES];
            for (BroadphaseNativeTypes i = BroadphaseNativeTypes.BOX_SHAPE_PROXYTYPE; i < BroadphaseNativeTypes.MAX_BROADPHASE_COLLISION_TYPES; i++)
            {
                for (BroadphaseNativeTypes j = BroadphaseNativeTypes.BOX_SHAPE_PROXYTYPE; j < BroadphaseNativeTypes.MAX_BROADPHASE_COLLISION_TYPES; j++)
                {
                    m_doubleDispatch[(int)i, (int)j] = m_collisionConfiguration.getCollisionAlgorithmCreateFunc(i, j);
                    if (m_doubleDispatch[(int)i, (int)j] == null)
                        throw new BulletException();
                }
            }
        }
Ejemplo n.º 2
0
 public void SetDispatcherFlags(DispatcherFlags flags)
 {
     m_dispatcherFlags = flags;
 }
Ejemplo n.º 3
0
 public void SetDispatcherFlags(DispatcherFlags flags)
 {
     m_dispatcherFlags = flags;
 }
Ejemplo n.º 4
0
 static extern void btCollisionDispatcher_setDispatcherFlags(IntPtr obj, DispatcherFlags flags);
 static extern void btCollisionDispatcher_setDispatcherFlags(IntPtr obj, DispatcherFlags flags);
Ejemplo n.º 6
0
		internal override bool needsCollision( btCollisionObject body0, btCollisionObject body1 )
		{
			Debug.Assert( body0 != null );
			Debug.Assert( body1 != null );

			bool needsCollision = true;

#if DEBUG
			if( ( m_dispatcherFlags & DispatcherFlags.CD_STATIC_STATIC_REPORTED ) == 0 )
			{
				//broadphase filtering already deals with this
				if( body0.isStaticOrKinematicObject() && body1.isStaticOrKinematicObject() )
				{
					m_dispatcherFlags |= DispatcherFlags.CD_STATIC_STATIC_REPORTED;
					Console.WriteLine( "warning needsCollision: static-static collision!\n" );
				}
			}
#endif //BT_DEBUG

			if( ( !body0.isActive() ) && ( !body1.isActive() ) )
				needsCollision = false;
			else if( ( !body0.checkCollideWith( body1 ) ) || ( !body1.checkCollideWith( body0 ) ) )
				needsCollision = false;

			return needsCollision;

		}
Ejemplo n.º 7
0
		internal btCollisionDispatcher( btCollisionConfiguration collisionConfiguration )
		{
			int i;
			m_dispatcherFlags = DispatcherFlags.CD_USE_RELATIVE_CONTACT_BREAKING_THRESHOLD;
			m_collisionConfiguration = collisionConfiguration;

			setNearCallback( defaultNearCallback );

			//m_collisionAlgorithmPoolAllocator = collisionConfiguration.getCollisionAlgorithmPool();

			//m_persistentManifoldPoolAllocator = collisionConfiguration.getPersistentManifoldPool();

			for( i = 0; i < (int)BroadphaseNativeTypes.MAX_BROADPHASE_COLLISION_TYPES; i++ )
			{
				for( int j = 0; j < (int)BroadphaseNativeTypes.MAX_BROADPHASE_COLLISION_TYPES; j++ )
				{
					m_doubleDispatch[i, j] = m_collisionConfiguration.getCollisionAlgorithmCreateFunc( (BroadphaseNativeTypes)i, (BroadphaseNativeTypes)j );
					Debug.Assert( m_doubleDispatch[i, j] != null );
				}
			}
		}
Ejemplo n.º 8
0
        public virtual bool needsCollision(CollisionObject body0, CollisionObject body1)
        {
            Debug.Assert(body0 != null);
            Debug.Assert(body1 != null);

            bool needsCollision = true;

#if DEBUG
            if ((m_dispatcherFlags & DispatcherFlags.CD_STATIC_STATIC_REPORTED) != 0)
            {
                //broadphase filtering already deals with this
                if ((body0.isStaticObject || body0.isKinematicObject) &&
                    (body1.isStaticObject || body1.isKinematicObject))
                {
                    m_dispatcherFlags |= DispatcherFlags.CD_STATIC_STATIC_REPORTED;
                    Debug.WriteLine("warning btCollisionDispatcher::needsCollision: static-static collision!\n");
                }
            }
#endif //BT_DEBUG

            if ((!body0.isActive) && (!body1.isActive))
                needsCollision = false;
            else if (!body0.checkCollideWith(body1))
                needsCollision = false;

            return needsCollision;

        }