Created
July 2, 2014 08:45
-
-
Save eelstork/b2d87732aec6d376bcb5 to your computer and use it in GitHub Desktop.
Check for non uniform scale in a transform hierarchy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this will check whether t, or one of its ancestors, | |
// have non uniform scale. | |
function hasNonUniformAncestor(t:Transform){ | |
while(t){ | |
if(isNonUniformScale(t.localScale))return true; | |
t = t.parent; | |
} return false; | |
} | |
function isNonUniformScale(s:Vector3){ | |
if(s.x!=s.y)return true; | |
if(s.x!=s.z)return true; | |
if(s.y!=s.z)return true; | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment