V4 creating a compound physics body with a MeshImposter of mass 0 in the children throws error

Example: https://playground.babylonjs.com/#66PS52#24

If you change the mass to higher than 0 the error disappears.

Pinging @trevordev

@mauricedoepke I think this is because meshImpostor should not be supported as a child. I will add an error message for this. Can you use primitives instead in your situation? Using convexHullImpostor also seems to work.

No, but I set the mass of the MeshImposters to 1 and the mass of the parents object to 0. That’s working for now. So if you don’t break that even if it isn’t supposed to be supported, I’m fine :sweat_smile:

Yea, this is a bit weird but MeshImpostor’s in ammo don’t even support mass but to be consistent with other psychics, if mass is set it uses convexHullImpostor instead. Is it okay if I break it and you use convexHullImpostor instead?

Just tried using convexHull instead. I need meshes, but could change my code so that they don’t have a parent. Why would you want to break that?

Using convexHullImpostor and using meshImpostor with mass != 0 should have the same result at the moment, this is why not setting mass to 0 works. I would throw an exception when using a mesh impostor to let the user know they should be using primitives instead. Would this be unexpected to you, if so I can just leave it alone.

Current PR is here: Physics debug support cylinders, throw exception when using meshImpostor in a compound impostor by TrevorDev · Pull Request #6116 · BabylonJS/Babylon.js · GitHub

1 Like

Sorry, you’re right. I did not see that I removed the parent from my mesh imoposters, so I got a different result in a quick test.

1 Like