Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Jasper1900 · Nov 26, 2014 at 07:35 PM · scale

Scale helmet to head size

Hi,

I am currently using many different characters in my game. Every character should be able to wear helmets. Is there some way to automatically scale the helmet untill the helmet fits on the head?

A scale overlap function, for example.

What method should one use to achieve the result?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by zharik86 · Nov 26, 2014 at 07:43 PM

The easiest way, it to create a script and to attach it to your "helmet". The example of a script is lower:

 //For example, each character have id
 public void myScale(int numCharacter) {
  if (numCharacter == 1) {
   this.transform.localScale = (0.9f, 0.9f, 0.9f);
  } else if (NumCharacter == 2) {
   this.transform.localScale = (0.8f, 0.8f, 0.8f);
  }
  //And etc
  }

And call this function how you dress your helmet. I hope that it will help you.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Jasper1900 · Nov 26, 2014 at 07:52 PM 0
Share

This is a solution, but I would like to write a function that returns the scale I am looking for automatically.

avatar image jackhearts · Nov 26, 2014 at 08:49 PM 1
Share

To be honest manually storing transform values like this is probably the most reliable and practical solution. I would probably store character head sizes in a script ins$$anonymous$$d so multiple helmets can adapt.

It may not seem that sophisticated but you could potentially waste a lot of time trying to automate something that may not be 100% effective.

Can't really think of anything that would single out the head size. $$anonymous$$aybe collisions or something in the $$anonymous$$esh class; $$anonymous$$esh.Bounds? Sounds like a lot of head scratching

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

27 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Scale collider independent of gameObject. 1 Answer

GameObject's scale gets 0 after being parented in editor 1 Answer

How expensive is scaling in 2D unity? Is it better to pre-scale? 1 Answer

How do I scale a 2D sprite over time? 2 Answers

change gameobjects size/scale acording to screen width? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges