Skip to content

Instantly share code, notes, and snippets.

@eelstork
Created July 2, 2014 08:45
Show Gist options
  • Save eelstork/b2d87732aec6d376bcb5 to your computer and use it in GitHub Desktop.
Save eelstork/b2d87732aec6d376bcb5 to your computer and use it in GitHub Desktop.
Check for non uniform scale in a transform hierarchy.
// 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