Hi,
I'd like to have any suggestions that would point me in the right direction for integrating Bullet with a huge quite special terrain/world (static as seen from Bullet).
Basically I want to have dynamical objects move and fly around and collide against each other and the terrain, with the terrain static with regards to these objects. However the terrain is also so huge that it can't be loaded into Bullet using any of the normal classes. It's changing too, so it would be CPU-wise inefficient to keep an up-to-date copy inside Bullet of it.
To start with I have already very efficient code to lookup close exact contacts with the terrain, for rays and AABBs. In fact that is what my physics uses currently. I don't have the code to do intersections with other Bullet shapes, but I could derive that code as well if it's needed.
I see basically two somewhat different approaches here and would ask for opinions on which to try first or which is more efficient. I'm not afraid of writing a lot of code, I'm more concerned about the efficiency of the result.
1)
Extract the positions of all objects currently being maintained by Bullet, and continuously feed Bullet with a trimesh or box-shape representing the closest parts of the terrain for each object. It would obviously have to be deleted and recreated as the objects move around. Then rely on the standard broad/narrowphases of Bullet for the CD and dynamics.
This is obviously less intrusive of Bullet, but I'm concerned about the efficiency of continuously deleting/creating these "close contact" meshes.
2)
Derive a new broadphase class which works for example as the SAP class for the normal objects but with the additional "hack" of knowing the exact geometry of the terrain, so I can integrate my previous collision-code here to quickly check for AABB intersections between it and the rest of the normal objects in the broadphase. The parts of the terrain that are active in the broadphase pass, has to be fed into the narrowphase collision detectors somehow, so the correct info I guess will be passed from my custom broadphase to the narrowphase using some custom new collisionshape or similar.
Thankyou for any hints!
How to collide a "custom-world" with normal bullet objs
-
- Posts: 22
- Joined: Sat Nov 26, 2011 5:41 pm