- Home /
Rotated child's geometry changed when attach to parent
! WARNING ! Can contain bad english.
I have i little problem, the geometry of child becomes deformed when attach to parent. In the scene editor, we can see that the collider (green lines/box) is not affected. Before explaining, i will show you some images:
If the rotation is (0, 0, 0), the problem is gone but when i start rotating the arm (block/child object) all the triangles start to deform. The first image: after detach the child from the parent, child's scale change. I have check for existing answers but it didn't work. > I you don't understand, tell me. I hope you found an solution.
Answer by Bunny83 · Jan 29, 2016 at 04:08 AM
Well, that's simply because you have a non uniform scaling on your parent object. You should seperate the concept of your logical hierarchy and the visual representation. So build up your hierarchy with empty gameobjects which all have a scale of (1,1,1). You can offset those gameobjects so they are at the right rotation point inside their parent object.
Now you can add box gameobjects as "child" objects of the empty gameobjects. Those boxes can be scaled and moved inside their parent object to appear at the right place. To move your robot arm you will always rotate the empty gameobjects and never the boxes. The boxes shouldn't have any child objects themselfs.
Example hierarchy:
Base // scale 1,1,1
+-Box Base // can be scaled as needed
+-Arm1Rot // scale 1,1,1
+-Box Arm1 // can be scaled as needed
+-Arm2Rot // scale 1,1,1
+-Box Arm2 // can be scaled as needed
+-Arm3Rot // scale 1,1,1
+-Box Arm3 //
+- ...
So the "ArmRot" objects are actually creating the hierarchy. Those must not be scaled, keep the scale at 1,1,1 Each ArmRot object can have multiple boxes as child which will visually make up that part of the arm.