where does the sweep and prune happen?

mickey
Posts: 107
Joined: Fri Sep 19, 2008 6:08 pm

where does the sweep and prune happen?

Post by mickey »

Hi

I'm digging deep into Bullet, been reading articles and I may have many questions, but to start with,

You create the btAxisSweep3 with the world bounds and maximum number of possible shapes that would be in the world.

Does bullet check if the object is still in bound? I assume the collision check for colliding objects is done in a the call to btCollisionWorld::updateAABB(...) (called in btCollisionWorld::performDiscreteCollisionDetection()) ?

Under updateAABB(...), I have a few questions.

I don't see any code that does a collision check and does this code:

btBroadphaseInterface* bp = (btBroadphaseInterface*)m_broadphasePairCache;
if ( colObj->isStaticObject() || ((maxAabb-minAabb).length2() < btScalar(1e12)))
{
bp->setAabb(colObj->getBroadphaseHandle(),minAabb,maxAabb, m_dispatcher1);
}

updates the AABB of an object? And in setAabb(..)

a call to btAxisSweep3Internal<BP_FP_INT_TYPE>::updateHandle(...) is made. Am i correct to say these things:

1. A handle is a pointer to the collision object
2. This where the the sorting/meat of the sweep and prune algorithm happens for all the objects in the world. Each objects axis are sorted into greater and less and arranged in an 1D array? But where is this array or where is the sorted array?

Following that - am I correct to say that the next call to m_broadphasePairCache->calculateOverlappingPairs(m_dispatcher1); assumes already that it now has a collection of overlapping pairs? And this one happened in sortMinDown/sortMinUp?

Okay I think that's plenty enough for now.

Many thanks.