btDbvt broadphase stages and tree

Post Reply
muhtargarian
Posts: 1
Joined: Sun Dec 22, 2019 5:27 am

btDbvt broadphase stages and tree

Post by muhtargarian »

I am working on a game AI that would allow ships in my game to avoid colliding. I figured I could use existing dynamic bounding volume tree used by the broadphase algorithm to avoid duplicate work. However, I am having hard time figuring out the inner working. While tree operations look fairly simple, I am pretty confused about broadphase side of things, particularly stages. I.E what do stages do, how does current stage / stage roots work? Seems like depending on current stage things get added to / removed from trees, so I figured it would be best to learn more about this prior to implementing anything.

Any information about this / material to increase my knowledge about the subject would be appreciated. I'd also welcome any other ways that would make more sense to implement navigational AI using Bullet.
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: btDbvt broadphase stages and tree

Post by drleviathan »

I don't have any good ideas about how one might dig into the internals of the btDbvt broadphase to feed your AI, however it is possible to use a btPairCachingGhostObject to help optimize tracking of nearby objects.

The normal scenario goes something like this: You have a Character who needs to know about nearby objects for some reason. You could perform a full bounding box query into the broadphase subsystem each frame to compute those nearby objects however that could become an expensive query when there are many objects in the World. If only you could cache the list of nearby objects and know when a new one has been added to the list or an old one has left! That is where the btPairCachingGhostObject comes in. A normal btGhostObject provides events when another object (1) newly overlaps, or (2) stops overlapping, in the broadphase. The btPairCachingGhostObject maintains a list of overlaps within the bounds of the btGhostObject and iterating over that list doesn't require a fresh computation.
Post Reply