- Home /
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.
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
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.
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.
@Fattie that's a fair point, and one to keep in $$anonymous$$d. Thanks :)
Your answer
Follow this Question
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