Child physics imposter dynamic positioning

Hi all,

I’m using ammo.js to create a physics imposter just like it is detailed here:

And can be seen on the playground here:

My issue is that as can be seen in the example,the positioning of the child imposter is done manually:
var boxCollider = BABYLON.Mesh.CreateBox(“box1”, 0.3, scene);
boxCollider.position.y = -0.13;
boxCollider.position.z = -0.13;

So whenever I change the scale of the parent skull mesh, I can’t seem to dynamically set this value. Changing the size of the skull will cause the demo to misbehave.

So my question: is there a way to set the position of the child box collider dynamically so it will be in the same relative place(at the bottom of the mesh)?

Thank you for any help.

cc @Cedric

You can change the scaling of the physicsRoot like this:

Babylon.js Playground (

Hi and thank you for your answer!

As you described, changing the following line updates the sub imposter scale as well:
physicsRoot.scaling = new BABYLON.Vector3(3,3,3);

Thank you!

1 Like