public void Constructor(DispatcherInfo dispatchInfo, CollisionDispatcher dispatcher) { m_dispatchInfo = dispatchInfo; m_dispatcher = dispatcher; }
//by default, Bullet will use this near callback static void DefaultNearCallback(BroadphasePair collisionPair, CollisionDispatcher dispatcher, DispatcherInfo dispatchInfo) { CollisionObject colObj0 = (CollisionObject)collisionPair.m_pProxy0.m_clientObject; CollisionObject colObj1 = (CollisionObject)collisionPair.m_pProxy1.m_clientObject; if (dispatcher.needsCollision(colObj0,colObj1)) { //dispatcher will keep algorithms persistent in the collision pair if (collisionPair.m_algorithm==null) { collisionPair.m_algorithm = dispatcher.findAlgorithm(colObj0,colObj1); } if (collisionPair.m_algorithm!=null) { ManifoldResult contactPointResult=new ManifoldResult(colObj0,colObj1); if (dispatchInfo.m_dispatchFunc == DispatchFunc.DISPATCH_DISCRETE) { //discrete collision detection query collisionPair.m_algorithm.processCollision(colObj0,colObj1,dispatchInfo,ref contactPointResult); } else { //continuous collision detection query, time of impact (toi) float toi = collisionPair.m_algorithm.calculateTimeOfImpact(colObj0,colObj1,dispatchInfo,ref contactPointResult); if (dispatchInfo.m_timeOfImpact > toi) dispatchInfo.m_timeOfImpact = toi; } } } }