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?
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 Cannon
You can rotate the Turret or the Tank objects without having skewed parts (at least it worked in a simple test I did).
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.