Proximity Detection using AABB Trees

Post Reply
morphogencc
Posts: 2
Joined: Thu Apr 16, 2020 7:08 pm

Proximity Detection using AABB Trees

Post by morphogencc »

I'm currently using Bullet as the physics engine for a 3d simulation of flocking. There are certain behaviors where I want objects to match velocity with neighbors, predictively avoid collision, etc. In order to do this, I need to be able to detect other physics objects that are near but not colliding with the target object.

Since Bullet is already tracking position information efficiently with an AABB tree, I wanted to know if there was an easy to do leverage it for proximity detection. I've read through the Bullet manual but I haven't found anything obvious in there yet.

How can I leverage the existing collision detection engine to get a list of all objects within, say, 200 pixels of the target collision object?
S1L3nCe
Posts: 50
Joined: Thu Mar 24, 2016 10:22 am
Location: France

Re: Proximity Detection using AABB Trees

Post by S1L3nCe »

Hi,

I think Ghost Object is the thing I would use here.
With a bigger size than the object it is paired with, it will be able to detect any other overlapping physic object before the collision.
morphogencc
Posts: 2
Joined: Thu Apr 16, 2020 7:08 pm

Re: Proximity Detection using AABB Trees

Post by morphogencc »

This looks great! Are there any examples that utilize this I could use as a reference?
S1L3nCe
Posts: 50
Joined: Thu Mar 24, 2016 10:22 am
Location: France

Re: Proximity Detection using AABB Trees

Post by S1L3nCe »

Found viewtopic.php?t=6195#p21693 on this forum.
It does not handle constraint between ghost objects and bodies to make them move together but it's a good start to know how to create ghost objects and handle collisions detection.
Post Reply