Best way to use spatial partitioning

Scheb
Posts: 2
Joined: Sat Jun 08, 2013 1:06 pm

Best way to use spatial partitioning

Post by Scheb »

Hi !

I'm new with bullet physics (I started this morning :) ) and I have few questions or confirmations to use spatial partitioning with bullet physics.

I want use bullet physic in my game engine. I have already done a spatial partitioning with an Octree to optimize the rendering when there are many objects in my world. This is a dynamic octree; recalculate in runtime.

I can get the neighbors of an object from its sector(s):

Code: Select all

GameObjectList GameObject::GetNeighbors(); // Generally there is a maximum of 10 neighbors. 
When an object moves, instead of checking collisions AABB of all 10,000 objects in my world, the physics engine could check for collisions AABB of neighbors only.

How can I do to use my octree to help the physics engine?


Before posting, I do a lot of research, especially on this forum. I found some interesting things, but I'm not sure.

I don't think I can create a btDiscreteDynamicsWorld by sector because objects may overlap several areas.
Maybe I have to use collision group (or mask, I do not know the difference the moment) for each sector.
Apparently, this is the role of btBroadphaseInterface to check candidates for collisions. Is there a way for me to provide it the list of objects on which to operate?