two collision objects
-
- Posts: 5
- Joined: Mon Dec 11, 2006 2:56 pm
- Location: orlando, florida
two collision objects
How To determine there is contact between two collision objects? And how to the collision force?
-
- Posts: 5
- Joined: Mon Dec 11, 2006 2:56 pm
- Location: orlando, florida
rephrase the problem
What I want to say is after one simulation step how do we determine two objects have contact by traversing the collision result efficiently.
We have the dispatcher of the collision world. We can surely use brute-force method. But A more efficient way would be idea such as saving a hash map of the object name and object tag. Build a one to many mapping.
Could somebody tell me where to insert that piece of code?
My guess is buildSimulationIsland.
We have the dispatcher of the collision world. We can surely use brute-force method. But A more efficient way would be idea such as saving a hash map of the object name and object tag. Build a one to many mapping.
Could somebody tell me where to insert that piece of code?
My guess is buildSimulationIsland.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
There is an array of overlapping pairs. This gets sorted every frame, using heap sort, during the
This means after the traversal of the dispatcher, you can do a binary search ,O (log(n) on this sorted m_overlappingPairArray. Just create a btOverlappingPair with your 2 objects, and call
Getting access to the applied impulse has to go through persistent contact manifold. I'm at GDC right now, so no time to check how to get access to this info (there might be a callback for this in one of the demos). Things are changing/improving so if necessary we can make an easier method of getting to this applied Impulse.
Hope this helps,
Erwin
Code: Select all
void btAxisSweep3::processAllOverlappingPairs(btOverlapCallback* callback)
Code: Select all
int index =m_overlappingPairArray.findBinarySearch(pair);
if (index < m_overlappingPairArray.size())
{
//found the index of overlapping pair
}
Hope this helps,
Erwin