Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I lately integrated Bullet Physics into my little game engine, but for now I only use basic shapes as spheres or boxes for collision checks. For more realistic physics I need collision meshes for all models in the scene. They should be much simpler and in lower detail than the actual model for drawing to speed up computations.

Since I want adding new asserts to the engine as easy as possible, I am looking for a way to automatically generate collision meshes. I could just use the actual mesh loaded from file and that would result in very realistic physics calculations but that won't be fast enough. Therefore, how can I generate low detail collision meshes from a given set of vertices?

This task doesn't seem trivial since there many different cases to handle. For example a model of a house with furniture must retain details of floor and door frames while ornaments should be removed. I believe there already was research on this topic, but I couldn't find anything useful yet.

share|improve this question
    
Convex hulls are a nice medium between boxes/spheres and the full mesh. –  ccxvii Apr 15 '13 at 11:07
    
I cannot walk into a convex room. –  danijar Apr 15 '13 at 12:17

1 Answer 1

up vote 6 down vote accepted

You can first decimate the mesh. Then use the decimated mesh to create a triangle mesh shape to create a collision mesh for that model.

You will probably run into issues with automatically generating meshes in this way. Since your physics object will not exactly match your world object. The decimating can have unexpected results for changing the shapes of meshes, particularly cutting off corners.

In my game, I define simple shapes in my modeling software (Blender), I name them something special like "PHYSICS_SHAPE_1", then my model importer looks for meshes with the name "PHYSICS_SHAPE*" and reads those to create physics objects. This is a little more work, but it ensures that my collision meshes are accurate and fits well with a data driven approach.

share|improve this answer
    
Thanks, especially your other answer you linked is very helpful. These algorithms are exactly what I was looking for. If someone minds, I will use the HACD algorithm that fits good into Bullet Physics. –  danijar Apr 15 '13 at 15:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.