Bullet physics in a large voxel world
Posted: Tue Aug 26, 2014 8:45 pm
I am trying to add Bullet to my game to replace my own physics code from a while back.
The whole is currently divided into 64x32x64 sections (x,y,z, y is up), currently targeting at least 800 such sections coming to 104,857,600 loaded blocks (not run the numbers, Id expect that to be at least 80% or so solid blocks, entirely "empty" sections are not loaded).
Since I have a 3D voxel grid, its already easy for me to determine which solid cubes are within some AABB, or intersect some ray, which were the primitive tests I built my own old collision code off of. However I am not sure how to plug that into Bullet. Simply creating and trying to maintain a massive list of surface cubs (or faces/triangles) is a significant effort itself, and I am not sure how well bullet would handle such a large object count even after I managed to create all that.
There was some talk when I searched around about creating a custom btRigidBody, but I haven't been able to find technical details on that, and the related classes are largely undocumented.
Ideally some method where bullet gives me an AABB to check, and I give it back a bunch of AABB (or potentially other shapes should I choose to add say slopes) for the cubes in that region, and then bullet proceeds to do its own thing with them.
The whole is currently divided into 64x32x64 sections (x,y,z, y is up), currently targeting at least 800 such sections coming to 104,857,600 loaded blocks (not run the numbers, Id expect that to be at least 80% or so solid blocks, entirely "empty" sections are not loaded).
Since I have a 3D voxel grid, its already easy for me to determine which solid cubes are within some AABB, or intersect some ray, which were the primitive tests I built my own old collision code off of. However I am not sure how to plug that into Bullet. Simply creating and trying to maintain a massive list of surface cubs (or faces/triangles) is a significant effort itself, and I am not sure how well bullet would handle such a large object count even after I managed to create all that.
There was some talk when I searched around about creating a custom btRigidBody, but I haven't been able to find technical details on that, and the related classes are largely undocumented.
Ideally some method where bullet gives me an AABB to check, and I give it back a bunch of AABB (or potentially other shapes should I choose to add say slopes) for the cubes in that region, and then bullet proceeds to do its own thing with them.