Jump to content
  • Advertisement
Sign in to follow this  
Libertas

(Box2D) Efficient ground collision setup in destructible voxel world.

This topic is 2545 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

For the type of world I mean, think of Terraria. 2 dimensional, destructible, rebuildable, etcetera. Now, with Box2D I know of only two ways to really set up collision for the 'world' as it were, which is either building the world out of polygons, or making collision edges out of vectors.







Problems i can see arising from the polygon method are, to name, either I'm stuck doing a small cube for every block on the map, even if I stick to only an area around moving entities, I still have to move it along resulting in constant trashing and remaking of polygon classes in memory.




The vector method sounds a bit better, but remaking the vector as I move or destroy/build in the world still seems a daunting task to get over. Along with all of this is the need to either recenter moving objects in the world or recalculate all the collidable world objects around them.




Anyone who's worked more with B2D have any ideas for me here?

Share this post


Link to post
Share on other sites
Advertisement
I would take a look at this section in the Box2D manual.
Collision Module


With polygon shapes you may run into internal edges. Meaning objects wont slide smoothly along the surface. I would recommend using edge chains as described in the box2d manual. In the end things will be more efficient and you wont run into internal edges.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!