I want to scale width/height of my character's head/body mutually independently.
But due to the bone structure as shown below, When scale the body(Hips bone), the head is also scaled.
So my code is like this and it seemed to be worked.
But rotating the spine(for animation), the head is skewed. This is my problem.
I found that this is common mathematical issue but I want to know how to solve it.
Unity's transform matrix and global scale is read only. How should I do?
Is there any way to scale width/height of my character's head/body mutually independently?
Non-uniform scaling CAN be done for skeletons without causing skew. In order for it to work, though, you'll need to invert the scale in the next node down. There must be one of these auxiliary nodes for each child of the original bone which you want to scale, and it must have the translation from the original node, the inverted scale, and NO rotation. Suppose you had a character with the following bone structure:
In order for this to work, you'll need auxiliary nodes for LUpperArm, RUpperArm, and Neck:
All this, of course, needs to be supported by your animations (by expecting LUpperArm to be a child of LUpperArmAux, for instance). In your animation program, make sure the LUpperArmAux bone has zero length, the LUpperArm node is constrained to have no translation, and the LUpperArmAux bone has its joint limits set to identity. And when you skin your character, make sure to exclude the Aux nodes from affecting vertices.
One way to do "scaling" is just to have two bones above move them further apart, thus stretching the skin between them. Combined with uniform scaling, this may be sufficient for what you're trying to do.
answered Jul 04 '11 at 10:42 PM
The skewing you see is exactly what you should expect. While you may seem to be scaling bones in Maya, perhaps you're just scaling the bone envelope. Regardless, once you have the model in Unity, any non-uniform scale of transforms will cause a skew in child transformed bones. You can see this effect in normal unskinned meshes too.
The reason is that scaling does not happen by a multiplying of X, Y, and Z independently, any more than position is merely the sum of parent transforms by independent axes. You would not want the arms to move 5 units along their Y local axis every time the player jumped the spine by 5 units vertically. So similarly, scaling the body by 5 times in the Y will not make the arms 5 times longer in their Y.
Only uniform (equal x,y,z) scaling will appear unskewed on child transforms (bones or otherwise). There is also no simple "unscaling" you can do in child bones.
As a corollary, you can safely scale the final bones non-uniformly (since they have no children).
answered Jul 04 '11 at 11:55 AM
And I am worried just about the same process.
Version 3.3 of my environment Unity3D, is the iPhone Pro Android Pro.
The local scale of the bone, what's a setting not solve, such as to affect the local scale of the bones of the child?
As far as experimenting with Maya, there is no problem changing the scale of the bones are free to In the same way I do it Unity3D.
Scaling of bone in the other games I use the Avatar seems like doing.
How well do you resolve it not?
answered Jul 04 '11 at 07:32 AM
Yeah, don't do non-uniform scaling - it will look weird when you will start animating the character (for example hands will be longer when they are in front compared to when they are at the sides).
answered Jul 11 '11 at 12:52 PM