Precise bounding box

Hey, can someone explain me what’s the way to create the most accurate bounding box on a complex model (war plane) to have accurate collisions with a physics engine ?

BabylonJS already creates a bounding box around your meshes upon creation/import, so I think you might be looking for something else. Do you mean multiple smaller boxes to create a compound physics-body, or are you looking for a way of creating a convex hull?

Hi @Katherek

By accurate, do you mean the smallest enclosing bounding box?
If so, you can try to compute a smaller oriented bounding box. Check this blogpost : minimum OBB | The Infinite Loop
And more specifically, the Rotating Calipers.
The article speaks of 2D coordinates system but it can be applied to 3D.

I think it’s not what I want to do, I want to create a “collisions box” who follows the vertices of the model but I think it’s hard to do so I think I have to create multiple boxes or try to use the rotating calipers.
How can I use the rotating calipers ?
Thanks.

rotating calipers is an algorithm…you’ll have to implement it yourself :slight_smile:

Ah okay thanks ! Also, If I use a physics Impostor with the type ConvexHullImpostor or with the type MeshImpostor it works fine but when there is a collision the performance is so much worse, do you know how to fix it ?

IIRC, the convex hull composition depends on the number of vertices. The more vertices, the more plans, the more cpu intensive. You can try to build the convex hull is a more simplified mesh input.
Or you can try compounds of volumes(sphere, box, …) to make an approximation of the mesh.

2 Likes

Thanks so much for helping me ! I’ll try and if I have another problem I will say it here.

1 Like