btVoxelShape for grid-based world support
Posted: Sun Aug 23, 2015 5:36 am
I have put together a branch of Bullet with support for a btVoxelShape - an infinite, 3D grid, where each cell can contain a collision shape with different settings (friction, restitution, rolling friction, user pointer). Its collision and ray/sweep algorithms take advantage of the grid structure to determine which cells are involved, and then delegate off to the correct algorithm for each cell's content.
The branch can be found here.
A quick summary of the changes in the branch:
This is a port of my previous voxel integration into JBullet.
A short article on the reason I took this approach over using existing collision structures can be found here.
The branch can be found here.
A quick summary of the changes in the branch:
- btCollisionObjectWrapper, LocalRayResult and LocalSweepResult were changed to carry additional information. btCollisionObjectWrapper now holds friction, rollingFriction, restitution and userPointer, to allow per-voxel (grid location) settings. The ray results now carry the collision shape and user pointer of the btCollisionObjectWrapper involved.
- Introduced btVoxelShape. This represents an infinite voxel world. It must be constructed with a btVoxelContentProvider, which provides the information on each voxel (as a btVoxelInfo).
This is a port of my previous voxel integration into JBullet.
A short article on the reason I took this approach over using existing collision structures can be found here.