Hi, apologies if this is an obvious question...
Can anyone tell me what the most efficient way to do a single paired collision test is?
In my simulation loop, I perform one complete “collision world” test and from that I then have a number of paired tests to perform where I move one object slightly each time.
I know which objects are involved and that they are definitely close enough to not need a broadphase test.
Execution time is of the essence so I’m assuming repeatedly calling the full “performDiscreteCollisionDetection” after moving a single object would be a bad plan.
Looking in to it I was wandering if I can create my own btOverlappingPairCache and just add a single pair to it before sending it on to btDispatcher::dispatchAllCollisionPairs but I’d be creating a new btOverlappingPairCache for each test which doesn’t seem like a hot plan.
If anyone can set me on the right path I’d be most greatful.
Cheers,
Individual pair collision tests
-
- Posts: 3
- Joined: Fri Jan 11, 2008 9:35 am
Re: Individual pair collision tests
Just in case someone's thinking, "that's such an easy question he'll figure it out himself in no time."... um, I haven't.
Any suggestions would be most appreciated!
cheers,
Any suggestions would be most appreciated!
cheers,
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Individual pair collision tests
So you want to have a loop like the following?
In that case, it helps if you keep track of a list of overlapping objects for each object. Bullet currently doesn't keep track of this, but you can add this. You can implement your own pair callback (see btAxisSweep3::setOverlappingPairUserCallback), and that callback you can update the list of overlapping bodies in each of the 2 involved objects. You can also check out Box2D (box2d.org). As part of its island management, it stores a list of overlapping objects in each object.
I might add support for such overlapping body list in each body for Bullet as well, but right now I'm flooded with other work.
Hope this helps,
Erwin
Code: Select all
for each object
move object
find all overlapping pairs that include this object
dispatch only those pairs to find new contacts
I might add support for such overlapping body list in each body for Bullet as well, but right now I'm flooded with other work.
Hope this helps,
Erwin
-
- Posts: 3
- Joined: Fri Jan 11, 2008 9:35 am
Re: Individual pair collision tests
Hi,
Many thanks for your reply, sorry for not responding I was side tracked onto a different project.
I've resumed what I was doing and setOverlappingPairUserCallback has given me the ability to control which pairs get sent off for near tests.
I'm still doing unecessary broadphase tests but it's such a low overhead it's not much of a problem and I'll dig deeper into Bullet when I get the chance if I really need the extra cpu cycles.
Cheers,
Many thanks for your reply, sorry for not responding I was side tracked onto a different project.
I've resumed what I was doing and setOverlappingPairUserCallback has given me the ability to control which pairs get sent off for near tests.
I'm still doing unecessary broadphase tests but it's such a low overhead it's not much of a problem and I'll dig deeper into Bullet when I get the chance if I really need the extra cpu cycles.
Cheers,