PhysicsImpostors on meshes with offset origin

I’m trying to create meshes in blender to be used as physics impostors for a compound shape in babylonjs. I’m facing a problem, where this would’nt work, when the mesh has an origin which is not in the center of the mesh, like this:

I’m using cannon and I wrote some code to visualize the actual shapes used by the physics engine (the magenta ones):

As you can see, the box impostor gets created with an origin at it’s center placed at the offsetted origin of the original mesh. I’m pretty sure I can work around this case and manipulate the cannon shapes in a way that the placement is correct. However I’m struggeling to figure out the excact way of how to do this, I’d be very grateful for some pointers in the right direction.

cc @Cedric

I’ll take a look at this issue in the coming days.

1 Like

Sorry for the delay. I can now spend time on your issue.

Check this PG : Babylon.js Playground

and this thread.
To sumarize, when creating physics impostors, babylon js will recompute the mesh center and use it as the impostor origin. delta position/rotation and then computed to offset the mesh geometry and match the impostor.

You should get a debug display with the Inspector view.

If now, can you please provide you scene or a PG to test it?

Hello, just checking in, was your question answered? @thomasaull