# Can you adjust the proportions of a 3D model via scripting?

We are developing a game in Unity where the character is different ages in different levels. Would it be possible to use a single 3D model asset, and alter its proportions via scripting to achieve this effect? For example, stretching the head to make it more oval for older self, or increasing head size for toddler self?

We don't have a model yet. We are envisaging a simplistic, cartoony look rather than something realistic. Is this doable?

• It's doable, but the result might not look very good. Also, I wonder if in addition to the body proportions you would also have to adjust the animations anyway to account for the different ages. So in the end, my gut feeling is that you won't safe much time doing a parameterized model over drawing the different ages separately, but the quality might be much worse. – Thomas Apr 10 '14 at 7:56
• I think Esa's answer nails it (even without a code example). – Thomas Apr 10 '14 at 8:58

Unity has the scale component in every transform. You can then scale the x,y,z of the model. So in theory if you have a model with separated body structure so that arms, legs and head are all individual GameObjects you can scale them individually.

• thanks for the confirmation - I'm very new to using models rather than primitives like cylinders and spheres - do models (e.g. from the asset store or that I would typically get from an artist produces Unity assets) typically have this, or is there no general consensus? if it's difficult to say, what should I be asking for / looking for in an asset? – david.libremone Apr 10 '14 at 11:14
• @d3vid The way the model is built is solely dependent on the artist. But for example .obj does not contain children when imported to Unity, so any .obj models will not work with this. – Esa Apr 11 '14 at 5:19

Scale in script:

gameObject.transform.localScale = new Vector3(2,2,2);

in the numbers you set the scale to each axis of your gameObject.

edit: like Esa say you need to do this in each part of your model, but you can make it in a bone of skeleton of animation that create the effect you need.

• please see my query comment to esa above about what is typical for models - thanks! – david.libremone Apr 10 '14 at 19:39
• depends what you need do. – JonesVG Apr 10 '14 at 19:42