Using Bullet Collision Detection in an existing simulator

Please don't post Bullet support questions here, use the above forums instead.
rvimadalal
Posts: 1
Joined: Tue Jul 10, 2018 9:49 pm

Using Bullet Collision Detection in an existing simulator

Post by rvimadalal »

Hi everyone,
I am a researcher working in the field of Granular simulations.

We have an existing code with custom collision detection and physics. I am trying to replace the collision detection algorithms with the ones used in Bullet. The strategy I have employed is to add bullet Rigid body pointers as data members of the Particles class (our equivalent of the btRigidBody) in our simulation. I add these btRigidBodies to discrete dynamics world and then find colliding pairs. So when I get contacting bodies from the persistent manifold I know which bullet objects are colliding. But I also want to know which Particles are colliding because our physics engine works with particles and not btRigidBody. I am thinking of using a map with btRigidBody as the key but since we will be operating on a scale of hundreds of millions of particles, it will be very slow. Any help would be appreciated :)
teolazza
Posts: 21
Joined: Fri Aug 11, 2017 1:16 pm

Re: Using Bullet Collision Detection in an existing simulator

Post by teolazza »

btRigidBody inherits from btCollisionShape a user pointer that you can make to point to your data. Just call
setUserPointer on your btRigidBody instance