1
\$\begingroup\$

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?

\$\endgroup\$
  • 2
    \$\begingroup\$ 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. \$\endgroup\$ – Thomas Apr 10 '14 at 7:56
  • \$\begingroup\$ I think Esa's answer nails it (even without a code example). \$\endgroup\$ – Thomas Apr 10 '14 at 8:58
3
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ 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? \$\endgroup\$ – david.libremone Apr 10 '14 at 11:14
  • \$\begingroup\$ @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. \$\endgroup\$ – Esa Apr 11 '14 at 5:19
0
\$\begingroup\$

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.