Example #1
0
        /// <summary>
        /// Determines all potentially intersecting pairs between geoms from the space
        /// and the specified geom. The exact behavior depends on the type of the geom.
        /// </summary>
        /// <param name="geom">
        /// The geom to test for potential intersection with the space.
        /// </param>
        /// <param name="callback">
        /// The callback function that will be called for each candidate pair.
        /// </param>
        public void Collide(Geom geom, NearCallback callback)
        {
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }

            NativeMethods.dSpaceCollide2(id, geom.Id, IntPtr.Zero, (data, o1, o2) =>
            {
                var geom1 = Geom.FromIntPtr(o1);
                var geom2 = Geom.FromIntPtr(o2);
                callback(geom1, geom2);
            });
        }
Example #2
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();
                }
            }
        }
Example #3
0
 public static extern void SpaceCollide2(IntPtr space1, IntPtr space2, IntPtr data, NearCallback callback);
Example #4
0
 internal static extern void SpaceCollide(IntPtr space, IntPtr data, NearCallback callback);