- Home /
How to change child's rotation whithout affecting it's scale?
I have a cube named "carBody" of scale (0.83,0.14,1.51). It has an empty gameobject of scale(1,1,1,) named "tire". And a sphere named "front tire" as a child of "tire".
Now the problem is, when i change the rotation of "front tire", it also changes it's scale automatically as it is a chlid gameobject,
i'm using this code to rotate: tire1.transform.eulerAngles = new Vector3 (10, 10, 10);
but it's also changing the scale. How can i stop it from changing it's scale?
Answer by YoungDeveloper · Oct 12, 2015 at 07:44 AM
Create fake parent which scale is normal (1,1,1). carBody should go under it and you should scale the fake parent, leaving actual carBody alone.
Hi, @YoungDeveloper as you said, i did this in scales Empty(1,1,1) -> Carbody (0.83,0.14,1.51) -> Tires(1,1,1) ->FTire(0.48, 0.85, 0.26)
But stil when i change rotation of Tires(1,1,1) from 0 to 45, it is still changing the scale.
Your tires and other transforms should also go under fake parent. If transforms scale is not 1,1,1 and you scale it, all children under it it will get distorted.