MeshImpostor is just ~slightly~ off

Hi all!
After a lot of fiddling, i’ve got a loaded GLB to which I apply a mesh collider. However, when I add other imposters to the scene (sphere imposters), they aren’t hitting the mesh collider right. They’re hitting, but slightly below the surface of the mesh.

I’m getting a warning message: “A physics impostor has been created for an object which has a parent. Babylon physics currently works in local space so unexpected issues may occur.” But I’m not sure how to interpret that message (b/c i thought the technique to add colliders to glbs was to create a parent and then add both the loaded glb and imposter into that container)?

Any ideas?? Thx so much!

See: setMeshGroundColliders on line 62 in the PG. And click mouse to add “boulders” to the scene, to see the issue. I’m trying to get the boulders to roll down the hill somewhat naturally.

DOH! It was an optical illusion caused by the physicsViewer.
I think it’s actually working as I want it to work. Although i am curious about that warning message.

Boy, it is super fun to send boulders down a slope.

1 Like

I think this thread will help:

Thanks @Evgeni_Popov, the trick from that PG worked like roses to synchronize Pos/Rot. But there’s a very funny physics behavior happening that i think is released to imposters.

Case 1: Meshes that are part of another mesh. Physics are wonky. It feels like there’s a hidden object that is impacting how the ball rolls. (see boulders that fall on load)

Case 2: Meshes that are loaded alone. Works great. (see boulders that fall on click)

I’ve got more or less the same code adding imposters to the meshes. What’s the difference?

Omg, finally got it. That was a bear.

The issue was that the physicsRoot needs to be positioned to match the world location of the loaded mesh. Otherwise, it’s like a hidden appendage rotating in space around the collider. Would be awesome if there was a way to make the physicsRoot visible?

1 Like

cc @Cedric

1 Like

Thanks for the infos. I’m working atm on a better impl. This is definitely be tested with the new plugin system.

1 Like