Bullet Physics Strategy for (infinite) scrolling track like terrain
===

I’m trying to find what options we have in Bullet to achieve a scrolling track like terrain where the terrain segments (or tiles) are reused once they scroll out of view.

In 2D engines such as Box2D and Chipmunk I would lay out static collision bodies with segment shapes or polygon shapes, repositioning them once they are out of view. Here’s a link describing this being done in the ActionScript version of Box2D: [http://www.emanueleferonato.com/2011/10/04/create-a-terrain-like-the-one-in-tiny-wings-with-flash-and-box2d-%E2%80%93-adding-more-bumps/][1]

Looking through some of the documentation, it seems like in Bullet we have multiple options for the shape, like btHeightfieldTerrainShapes or btStaticPlaneShapes or btBoxShapes. In addition I also looked at the AppConcaveDemo in the demos that come with BulletPhysics, and I saw that it’s using a btBvhTriangleMeshShape and the vertices are being recalculated. Would maybe this be the better option?

Looking at these different options, I’m wondering if there are any thoughts on how to best achieve something like this keeping in mind that the terrain scrolls horizontally, similar to the game TinyWings and should be narrow as a HotWheels car track.

I’m not looking for a detailed technical implementation, but rather a discussion of the merits of one technique over the other, being performance the primary consideration.

Note: Not sure it’s worth mentioning, but this terrain would interact with both rigid and soft bodies.

Thank you,

Claudia


  [1]: http://www.emanueleferonato.com/2011/10/04/create-a-terrain-like-the-one-in-tiny-wings-with-flash-and-box2d-%E2%80%93-adding-more-bumps/