While I appreciate Kevin Reid's answer, it was at a level that was higher than what my question was asking. Understandably with out knowledge of Bullet Physics, it'd be hard to answer this question. I got this working and have an answer that is specific to Bullet Physics.
Along with extending the RigidBody
class like I mentioned in my question. I also needed to extend the CollisionAlgorithm
class. This is mostly to override the processCollision()
function. Inside the processCollision()
function (which takes the two colliding bodies as arguments), I was able to create a cube shape and appropriate Transform
for the cube that my entity was currently colliding with. Then just let the default collision happen based on the entity and the specific cube/cubes it's colliding with. In order to use the newly extended CollisionAlgorithm
, I needed to register the algorithm to deal with the shapes I want it to handle. In this case that's pretty much the terrain type against everything else. For that I used registerCollisionCreateFunc()
with my CollisionDispatcher
.
So for those following along in the future:
- Extend
RigidBody
to have a basic collision check with your terrain. - Create a instance of your
RigidBody
class and add it to yourDynamicsWorld
or whateverPhysicsProccesor
you're using. - Extend
CollisionAlgorithm
, specificallyprocessCollision()
to create Bullet Physics shapes and Transforms that match with your collision location. - Register your version of
CollisionAlgorithm
with yourCollisionDispatcher
usingregisterCollisionCreateFunc()
. (This registration is done multiple times, once for each pair of shapes you want to collide.)
EDIT
Here's a video of it in action if anyone is interested.