How to calculate the local scale to make the global scale as (1,1,1) for rotated obj?

How to calculate the local scale to make the global scale as (1, 1, 1) for rotated object in 3D?

Hi guys, in 2D, the parent coordinate’s local scale is (x, y) for x axis and y axis, the child’s local scale is (x’, y’) for x’ axis and y’ axis. The rotation between these two coordinates is a degrees. The child will inherit its parent object’s scale by default in the engine used.

So in order to make the object has a global scale of (1, 1), so that it will not deform even its parent object was rescaled.

x * (cos(a) * x’ + sin(a) * y’) = 1
y * (cos(a) * y’ - sin(a) * x’) = 1

if I have x and y, I can get x’ and y’ by solving the equations above,

extent it to 3D,
ParentScaleVector * ChildLocalRotationQuternion * ChildLocalScaleVector = (1,1,1)

but still this way is wrong, I could not get the right local scale to make the global scale as (1,1,1), I guess it’s different from the force vector in physics which has a direction in the coordinate, the scale don’t has a direction along the same axis, (1,1,1) and (-1,1,1) seems the same, only the absolute value matters. so I guess I cannot handle the scale vector like what I did before…

The standard cause for this problem (which didn’t help me but may help you) seems to be a combination of:

  • non uniform scaling on your parent object.
  • AND arbitrary rotation on your child object.

Scale is different from force, i cannot simply cast a rotated scale into parent’s coordinate and do an addition.

so again, How to calculate the local scale to make the global scale as (1, 1, 1) for rotated object that has non uniform scaling parent in 3D? Thanks!

that’s because I cannot set the lossyScale, so I want to figure out the local scale to make the lossyscale as (1,1,1)

Have you tried something like 1/transform.lossyScale?

I just did, not working…

but I found this post

http://forum.unity3d.com/threads/2270-world-scale?highlight=lossyScale