- Home /
Difficulties in Changing the Scale of an Object
In my game, I have people walking around, and I want them to spawn with different sizes. So I edited the "localScale" variables, like this:
if(randomsize == true){
var scale = Random.value+0.5;
transform.root.transform.localScale.x*=scale;
transform.root.transform.localScale.y*=scale;
transform.root.transform.localScale.z*=scale;
}
Which resulted in this:
Also, the characters' hierarchies.
The sizes of the objects are scaled, but the distances between the objects are unchanged as seen in the picture, where people have either tiny floating head or their tops bursting off with the pressure. Does anyone know how to fix this?
Answer by kubci98 · Jun 22, 2013 at 01:51 PM
Do you change scale of Guy or of Body? Guy should be an empty GameObject, where Body, head and hands are capsules / spheres. If you change Guy scale, all his childs should change
Yes, I changed Guy, which is an empty gameObject, but the problem isn't scaling - the spaces between are messed up.
Answer by Bunny83 · Jun 25, 2013 at 06:43 AM
The distances will scale along with the child scales. I guess you have an animation on the parent object which messes up your positions.