I’m developing a configurator with loaded .gltf objects. It’ll be necessary to have some meshes set as parent of others (because they have to move together). But it’s important that the scaling of the parent doesn’t affect the scaling of the child, since it’ll be a fixed object in dimensions.
In Blender there’s the constraint “Child of” feature, in which you can relate two objects and set which transformation won’t have an impact on the child (for example X ax of scaling property).
I tried to export it but it seems that babylon doesn’t keep the relationship.
I searched in the mesh documentation but i couldn’t find any properties / methods related to this goal.
When looking up online I found this trick of setting the child’s scaling to be the inverse of the parent → babylonjs - Babylon Js children that follow parent withouth the scaling - Stack Overflow
childMesh.parent = parentMesh; parentMesh.computeWorldMatrix(true); childMesh.scaling = Vector3.One().divide(parentMesh.absoluteScaling);
but it’s lowering the performance a lot and it still doesn’t calculate correctly the position.
Another topic of stack overflow says that (as of 2016) they couldn’t find a way to export ChildOf constraint from blender model. – blender - parent-child linking between meshes in Babylon.js - Stack Overflow
I wondered if there’s a feature in babylon api to achieve this, or if someone has suggestions on how to proceed.
Otherwise I thought about creating for each parent mesh an empty object on the edge of the mesh, to which the child will always snap to for every transformation. So they would be fake parent - child, only related to that pos x, y, z of the empty object.
But idk, i wanted to see before starting this new procedure, if there was something easier.
Thank you very much and have a great day!