- Home /
Geometry distortion on child objects
Hi,
I have quite a few objects that get large geometry distortions.
I've been working under the assumption that the cause of this is a combination of non-uniform scaling on the parent and arbitrary rotation of the child (from the unity scripting manual under lossyScale), however nothing I do seems to fix the problem.
All the parent objects have a scale of 1,1,1, and, just to make sure I've put this script on the parents as well:
function Awake () {
gameObject.transform.localScale = Vector3.one;
}
The children objects do all have odd rotations (they were originally set to regular numbers, but 90 seems to become 90.000001 or 89.999999 etc), but I even tried to counter this with the following script:
function Awake () {
transform.eulerAngles.x = Mathf.Round(transform.eulerAngles.x);
transform.eulerAngles.y = Mathf.Round(transform.eulerAngles.y);
transform.eulerAngles.z = Mathf.Round(transform.eulerAngles.z);
}
Our game is literally riddled with this problem, and it seems to be happening to more and more objects, and I've simply run out of ideas on how to fix it.
Thank you in advance for any advice!
Yours
Miriam
ps. un-parenting everything really isn't an option - the scene would become insanely messy and unmanageable.
I have seen the same thing, but hasn't bothered me, I think it's the way unity rolls, can someone confirm? Atleast .000001 isn't really visible to the player.
Answer by Eric5h5 · Jul 06, 2010 at 08:39 PM
It's not something you need to fix. That's the result of floating point imprecision when converting quaternions to euler angles, and the difference between 90 and 90.000001 is incredibly small and unnoticeable.
Hi, thanks for your answer. The only reason I was fixing it was in the hope that it would fix the object skew. (according to the unity scripting manual (under lossyScale) the combination of a parent with non-uniform scaling & a child with arbitrary rotation is the cause of the strange object skew)
Have you got a screenshot of the skewing? It sounds very peculiar...
Answer by haydster7 · Oct 03, 2014 at 08:36 AM
Try adding an intermediary empty GameObject then making that a child of the object with non-uniform scale. Use the empty gameobject as the parent.