Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by SpectralEdge · Oct 06, 2012 at 10:54 AM · vector3scalecompare

Compare Scales

I feel silly for needing to ask this but google and the forum/answer search is not giving me an answer.

How do I compare two scales to see if they are '=<'? Because scale is a vector you cant really use '=<'. I know for position I can use vector3.Distance, but that does not seem to work for scale.

Sorry if this is a simpleton question.

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
3
Best Answer

Answer by shaderop · Oct 06, 2012 at 11:10 AM

Edit:

Compare the magnitude of the localScale vectors:

 if (objectA.transform.localScale.magnitude <= objectB.transform.localScale.magnitude)
    // ObjectA is scaled smaller than ObjectB
Comment
Add comment · Show 4 · 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 SpectralEdge · Oct 06, 2012 at 11:20 AM 0
Share

I need the comparative scale as I am scaling the item in different directions. I could check every direction but I really would like to just see when they match or when one of the coordinates gets too small without having to check every axis.

avatar image SpectralEdge · Oct 06, 2012 at 11:46 AM 0
Share

Perfect, thank you. I didn't know about magnitude.

avatar image Fattie · Oct 06, 2012 at 12:39 PM 2
Share

purely FTR you can use this

http://docs.unity3d.com/Documentation/ScriptReference/Vector3-sqr$$anonymous$$agnitude.html

IF, that's IF, for some reason, this is something you are doing literally 100,000s times++ per second.

avatar image shaderop · Oct 06, 2012 at 12:56 PM 0
Share

@Fattie that's a fair point, and one to keep in $$anonymous$$d. Thanks :)

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

10 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

Related Questions

Object Scale Lerp with rigidbody addforce jump duration. 1 Answer

I'm trying to make a zoom by changing the scale of the object and need constraints 1 Answer

How precise is unity with it´s transforms? 2 Answers

Vector3.Scale and rotated colliders 1 Answer

How to stop scale reducing from reaching Zero (Solved) 1 Answer


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