I have this funny issue ConvexHullImpostor. I loaded a test scene with a sample convex hull mesh called testHull from an external gltf file. I set a box and a sphere with mass of 1 WAY up top of the convex hull mesh… After 2 seconds i create the physics imposter and watch for where the box and sphere collide with the testHull… It looks like the actual physics representation of where that collider is does not match the actual mesh object. It is colliding to high.
But if i use a simple BOX it is placed correctly. I read some forum post (which i cant find again) it was talking about the POSITION ORDER of how the addPoint function is called. Dunno… Does anybox have any troubles using the ConvexHullImposter on an actual convexed hull geometry and a simple box shaped mesh.
Yo @Cedric … I think its the pivot point of the convex hull mesh. It looks like Bullet/Ammo.js will re-center the convexshapes around the center of the mesh. Its expecting the pivot point of the mesh to be in the center. The mesh that was the source of the convex null looks like the pivot point is at the BOTTOM of the mesh (Even in Unity). When use the inspector with the transform gizmo visible the gizmo also shows at the bottom of the convex hull mesh.
So yeah… how would we compensate when the pivot point of the convex hull mesh is NOT in the center ?
Can you please test to call setDeltaPositionPhysicsImpostor | Babylon.js Documentation
The value would be the difference between the center (bbox center?) and the origin( 0,0,0 I guess)
If it fixes it, I’ll do a PR to do it automatically
Yo @Cedric so i used Blender to SetOrigin to center and resaved as FixedHull.glb
and it works better… I think btConvexHullShape should be setMargin(0)… as per MANY posts on the gap. But centering the pivot fixed that… But i cant always use blender to recenter all the convex hull meshes, so any help in the DeltaPosition offset approach you are talking about would be great. I am not sure how to do it myself. May you can fix up the playground to do it: