Sign in to follow this  
jrh2365

[Bullet] Static level geometry - boxes or triangle mesh?

Recommended Posts

Is there a recommended way to handle static level geometry in Bullet? I'm not sure whether I should use box shapes (and some convex hull shapes) or a triangle mesh shape.

My kinematic character controller works reasonably well with boxes, but there's a couple of issues when using triangle mesh shape and InternalEdgeUtility. I haven't figured out if they are problems with my code, the port, or InternalEdgeUtility. So if it happens to be the case that box shapes are the way to go, that would probably save me a considerable amount of debugging. One potential downside to the box shape approach is that it seems like creating a level with box shapes would be more time consuming.

If I were to use box shapes, how should I handle when walls intersect at non-right angles. Should I try to avoid overlap between the walls, which may require using convex hull shapes in some cases? Or is it not a problem?

Share this post


Link to post
Share on other sites
I use a tri-mesh for my level geometry (subdivided into mulitple meshes) without any problems. The problem with boxes is, that bullet need to manage each box as individual object, whereas a tri-mesh is a single object.

Share this post


Link to post
Share on other sites
I'm afraid there's no well-established way demonstrated to be superior.
I use an assembly of simple collision shapes. In my current dataset, it's probably about 70% boxes, 20% hulls and 5% spheres. I must say that my current dataset is pretty much ideal. Back when I used a more generic one to stress the workflow, it was about 90% hulls and 10% boxes. Unfortunately, I have no recent performance data but I'm inclined to overuse the broadphase first.

Did you manage to make [font=courier new,courier,monospace]InternalEdgeUtility [/font]work? It doesn't do anything for me. Not even in the demo!

[quote name='jrh2365' timestamp='1347843794' post='4980749']If I were to use box shapes, how should I handle when walls intersect at non-right angles. Should I try to avoid overlap between the walls, which may require using convex hull shapes in some cases? Or is it not a problem?[/quote]What is your concern? Static geometry can encroach as you want, at worse, collision pairs will be somewhat redundant, it's not much of a big problem as - in the end - one of the two contact points will get filtered away. I'm interested in understanding your question.

Share this post


Link to post
Share on other sites
Use a triangle mesh, or experiment with using more smaller triangle meshes. Using boxes for level geometry will be a pain and it will restrict you too much on the level design part.
All physics engines use some kind of an algorithm that speeds up static triangle mesh collision a lot.

Share this post


Link to post
Share on other sites
Thanks for the suggestions, everyone. I guess for now I'll spend some time looking at my triangle mesh code to see if I can work out the issues.

[quote name='Krohm' timestamp='1347865354' post='4980794']
Did you manage to make InternalEdgeUtility work? It doesn't do anything for me. Not even in the demo!
[/quote]

Heh, depends on your definition of "work". I got it to prevent the player from being able to stand on the diagonal of slopes that should be too steep to stand on, but it seems to have introduced a couple of other problems. The player can't walk off some edges, and when jumping straight up in a corner formed by short walls the player starts teleporting up and down. I'll try another port and see if I get the same behavior as a start. I've not run the demo yet, so I should probably do that too.

[quote name='Krohm' timestamp='1347865354' post='4980794']
What is your concern? Static geometry can encroach as you want, at worse, collision pairs will be somewhat redundant, it's not much of a big problem as - in the end - one of the two contact points will get filtered away. I'm interested in understanding your question.
[/quote]

Yes, that answers my question, thank you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this