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 ... ore-bumps/
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
Strategy for (infinite) scrolling track like terrain segment
-
- Posts: 4
- Joined: Fri Jul 29, 2011 5:03 pm
-
- Posts: 225
- Joined: Wed Jan 07, 2009 11:43 am
- Location: London
Re: Strategy for (infinite) scrolling track like terrain seg
I've played around with adding in new collision objects as part of a terrain streaming solution and didn't really run into any particular performance issues. If you can dictate the order in which the objects would be loaded then you can just add and remove them as needed. In general the broadphase will cull out most sections so you'll probably one have a few 'active' static objects that might go down to narrowphase during you collision anyway.
If you do something different like modifying a single TriangleMesh to represent the terrain changes you're also going to have to fool the system to an extent as your car/plane will effectively be standing still with the terrain changing under it....
If you do something different like modifying a single TriangleMesh to represent the terrain changes you're also going to have to fool the system to an extent as your car/plane will effectively be standing still with the terrain changing under it....
-
- Posts: 4
- Joined: Fri Jul 29, 2011 5:03 pm
Re: Strategy for (infinite) scrolling track like terrain seg
Thanks for the info! This might make it simpler for me, given I can reuse some of my existing 2D scroll logic and add a third dimension.