I'm trying to make in godot a little voxel engine like minecraft.
I have entities, each entity is a rigidbody that are like a minecraft world. AKA have a system of chunks. Each chunk contains 16x16x16 voxels, when updated it generates its shapes and add them to the entity.
Problem is in worst case scenarios where you have around 600 shapes per chunk (the shapes are merged into bigger boxes as much as possible already), it takes more and more time to add shapes to it. The first chunk takes 600ms, the second chunk 4000ms, 8000ms, ect....
I've tested 3 methods:
1) Using the physics server, creating box shapes and adding them to the body using rids
2) Using the CollisionObject API, creating a shape owner per shape and adding it to the body. Takes 200ms for the first chunk, 400 for the second....
3) Using the CollisionObject API, having one shape owner per chunk and adding all his shapes into it. Takes 30 seconds for the 1st chunk, 1min for the second....
The update times for all these methods were also awful and proportional to the number of chunks existing in the entity.
Why I don't do a static body per chunk: My entities are going to move and will need to have a consistent shape all in all.
Is there something I do wrong? Is there a better method for this?
I saw that there were convex collision shapes but they're only for static objects.. Is there something I can do to improve the number of shapes, or divide this rigidbody in smaller bodies that follow each others or anything that'll make all this less heavy?