Quick questions about btCompoundShape

Post Reply
User avatar
EddieBytes
Posts: 22
Joined: Sun Jul 24, 2011 5:07 pm
Contact:

Quick questions about btCompoundShape

Post by EddieBytes »

I have about 10.000 blocks forming the terrain of a 2D game. See image here
Each block is a btBox2DShape and a btRigidBody of its own. Due to this, the game's fps bogs down to a lousy 4 frames per second or worse.

1) If I used a btCompoundShape to group all those btBox2DShapes into a single shape within a rigid body, would that speed things up?
2) Can another rigid body reside inside the aabb of such a compound shape? For example, if a cave was a single btCompoundShape made of such boxes, could a separate rigid body, say, representing the player freely and bugless-ly navigate through such a cave?
3) The terrain is constructible/destructible at runtime, that means it constantly changes its composition meaning boxes constantly get attached and detached from the terrain. What kind of object/body/shape do I need for such a terrain, if btCompoundShape is not viable?

Thanks
User avatar
EddieBytes
Posts: 22
Joined: Sun Jul 24, 2011 5:07 pm
Contact:

Re: Quick questions about btCompoundShape

Post by EddieBytes »

1) If I used a btCompoundShape to group all those btBox2DShapes into a single shape within a rigid body, would that speed things up?
2) Can another rigid body reside inside the aabb of such a compound shape? For example, if a cave was a single btCompoundShape made of such boxes, could a separate rigid body, say, representing the player freely and bugless-ly navigate through such a cave?
I'll reply to myself:
1) no, it merely groups them together, the fps is the same
2) it works just fine

My last question still remains:
how can I group all boxes into a single shape? Is there a way I can 'add' shapes to form a new shape? For example add one btBox2DShape and another btBox2DShape and obtain a new btBox2DShape? I don't have the math skills to do the mesh additions myself, so, how can I achieve this?
Note: btBox2DShape is just an example, the terrain might have other shapes too in its composition, like cubes and triangles and whatnot.
Post Reply