- Home /
Object skewing on rotation
I am having a problem rotating basic objects. This problem did not occur until Unity 3.0 came out. I built a tank using the basic shapes in Unity. I have the tank built using a few empties and then attaching cubes and cylinders on to it. With the object so layered when i rotate it, it skews the position and size of the child objects. Any idea why that is happening?
Answer by aldonaletto · Dec 22, 2011 at 03:23 PM
That's a well know problem: when you child objects to a non-uniformly scaled parent, rotating the children make them skewed (see lossyScale). You should have the parent uniformly scaled to avoid this problem. It's impossible with the simple cubes, unless you create some scaling script that scale the mesh vertices and return the object's localScale to some uniform value. But since this isn't a trivial script, it would be easier to create cubes or other solids in the correct scale in Blender, 3dsMax or other 3D editing tool, then import and use these solids in Unity.
EDITED: I've just tested something that worked: don't child the objects directly to a non-uniformly scaled parent - child this non-uniform object to an empty object, which will be the parent of the other objects too; since an empty object is scaled 1,1,1, childing other objects to it don't cause this problem. The tank structure could be something like this:
Tank (empty object) Body (non-uniformly scaled object) Turret (empty object) Turret body CannonYou can rotate the Turret or the Tank objects without having skewed parts (at least it worked in a simple test I did).
I have been stuck on this issue in my 2D world. It turned out that I had a child's parent scaled incorrectly, which caused the rotation of my child objects to skew when rotating. Thank you for your experienced answer.
Answer by emcx · May 06, 2014 at 05:26 PM
To chip in my similar problem and solution - I imported my models from blender and the scale in animations was going bananas in unity, while being ok in blender. What I found was animating rotation of objects with non-uniform scale, made their children do wonky scale skewing in unity. A quick fix to this, you can select parent objects in blender, and ctrl+a to apply their scale and rotation. That way all their child objects will have a nice 1,1,1 scaled parent, and my skewing issues were gone.
Had hit exactly the same issue. For Blender models this is a great tip/solution that avoids the need to restructure the hierarchy of your model. $$anonymous$$any thanks emcx!
Thank you. I had an object on a hinge changing shape while swinging, when just a few $$anonymous$$utes ago it worked fine. The problem was that I assigned that object under a parent object so I can move it around more easily with the other objects.
Your answer
