Scale it to an uneven proportion (for example: (10,1,1))
Create another mesh and set the previous mesh as a parent
Rotate the child mesh in an axis perpendicular to the previous scaling (so, for example, rotate in ANYTHING BUT the (1,0,0) axis for a (10,1,1) scaling)
As you can see, the cone mesh maintains the right proportions if left without rotation, but after rotating it, it warps and stretches out to match the parents scaling, reaching the maximum level of distortion at 90 degrees. (Rotating it in the (0,1,0) axis doesnât distort it as the x and z scaling is the same.)
Using rotationQuaternion, rotate() or directly assigning values to the rotation vector doesnât seem to make a difference.
Checking the inspector shows no changes in the childâs scaling property, but logging the âmesh.absoluteScalingâ property, it reports that the absolutescaling is being modified.
I have also tried setting the meshâs parent to null, rotating, then setting it back to the other mesh, but the result is that the child mesh starts scaling up exponentially up to infinity, as illustrated in this other playground (i have changed it to rotate every time a left click is performed on the scene, instead of every frame, to make it possible to see what is happening): https://playground.babylonjs.com/#EG9MEI#5
Hi and welcome to the Community,
Iâm not sure what you are expecting just exactly but I can try answer the title of your post.
In short, the answer is âYESâ. When parenting to a mesh or a node (abstract or transform) any change made to the parent after parenting will be affecting all children. This is an expected behavior. Now (again Iâm not sure what you are trying to achieve), but there are a number of ways around this. The one I personally (with my small âdesignerâ brain ) use the more often, is that I create a transformNode or an abstractMesh to rule the mesh or hierarchy. Means Iâm using an imbrication of parented nodes and I scale only the parent where I want my children to scale (or rotate or position).
Iâd leave the first parent (transform or abstract) at normal scaling and then for each object or group of objects within this parent, I create a new parent node and apply my rotation, scaling, position,etc⌠for this parent and all its children.
As I said, there are other methods. Iâll let someone else tell you about those (since as I said, I donât know what you want to achieve). Still hope this helps (else, let us know).
Meanwhile again, welcome to the Community and have a great day
The issue is not that the child inherits the parent scaling and rotation. Look at what happens:
I scale the parent before parenting the child mesh.
I use the .setParent() method so the child keeps the original position, scaling and rotation after being parented with the object.
I start rotating the child object, not the parent, and after rotating it distorts itself, depending on which direction it is facing.
Yes, depending on the situation, you can do a workaround by parenting both objects to a different object, but that would defeat the purpose since the object then becomes a sibling of the original parent object, instead of the child, and it would screw up the hierarchy for me.
I posted this on bug reports since this doesnât seem to be the intended behaviour.
The outcome is that we would probably need to support shear deformation in our transformations, but this is not something we plan to do, as it would represent a huge change in the code base. Handling non-uniform scaling is always a problem and should be avoided if possibleâŚ
Thanks. I didnât realize there was a similar topic open already, i searched for âmesh distortion/warpingâ and similar wording but didnât see anything related at first glance.
P.S: I âthinkâ i have some sort of workaround⌠but it doesnât cover up for rotating the parent mesh before adding the children (like in the example you have mentioned)
Making a new transformNode, placing it in the childs position, then parenting the child to the anchor, and the anchor to the node seems to work somehow. Rotating the child seems to work fine, rotating the anchor warps the shape as usual.
P.S 2: I tried resetting the parent rotation to zero, then adding the children, then setting it back to its original state. It seems to work.