Reference Parent Mesh

Hello Everyone!

In the PG below, the children of parent clones are moving independently and correctly. However, I’ve been unable to reverse the process, meaning to translate child mesh movement into movement for its specific parent. The exception is when I reference the original parent mesh (“B”). In that case, it works, but only for that one individual parent mesh (you’ll see it move across the scene).

I’m almost positive the incorrect line is in bold below, but I’m not sure what it should be. I’ve tried many variations with no success.

if (childMesh.rotationQuaternion.toEulerAngles().y < 0)
B.translate(BABYLON.Axis.X, -0.02, BABYLON.Space.LOCAL);

PG:
https://www.babylonjs-playground.com/#1Q0NKX

This bold line only references the original parent mesh (“B”) so will only apply to that mesh.

Is this what you want https://www.babylonjs-playground.com/#1Q0NKX#1?

1 Like

That’s exactly right! Using mesh.translate to refer to all the meshes in the array makes perfect sense now. I really appreciate the help, thanks again!