# Scaling width/height of a character's head/body

 0 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. ``````Hips Pelvis ... Spine ... Head ``````So my code is like this and it seemed to be worked. ``````void LateUpdate() { HipsTransform.localScale = new Vector3(hipsWScale, hipsHScale, hipsWScale); HeadTransform.localScale = new Vector3(headWScale / hipsWScale, headHScale / hipsHScale, headWScale / hipsWScale); } ``````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?Thanks. more ▼ asked Jun 30 '11 at 06:05 AM Ananta 31 ● 2 ● 2 ● 4 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

 0 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: ``````Hips Spine LUpperArm LForeArm LHand RUpperArm RForeArm RHand Neck Head LThigh ... ``````In order for this to work, you'll need auxiliary nodes for LUpperArm, RUpperArm, and Neck: ``````Hips Spine // Contains non-uniform scale LUpperArmAux // Contains inverse scale of Spine, translation from LUpperArm, and no rotation LUpperArm // Contains no translation LForeArm LHand RUpperArmAux // Contains inverse scale of Spine, translation from RUpperArm, and no rotation RUpperArm // Contains no translation RForeArm RHand NeckAux // Contains inverse scale of Spine, translation from Neck, and no rotation Neck // Contains no translation Head LThigh ... ``````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. more ▼ answered Jul 11 '11 at 01:56 PM sneftel 1.7k ● 7 ● 9 ● 20 Finally I adopt your way and now I can use non-uniform scaling, thanks Ben 12! (Because I don't need to translate bones, I simplified your method.) Moreover, as Warwick Alison said, the performance is still good though I add bones which don't affect any skin vertex. It's all right! Thanks everyone! Jul 19 '11 at 07:13 AM Ananta add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users
 0 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. more ▼ answered Jul 04 '11 at 10:42 PM Waz 6.4k ● 22 ● 33 ● 71 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users
 0 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). more ▼ answered Jul 04 '11 at 11:55 AM Waz 6.4k ● 22 ● 33 ● 71 Thanks Warwick.I can't adopt the way in your another comment due to bone number limitation of my project.But I'm going to try another method, hinted by your answer "can safely scale the final bones non-uniformly".It doesn't still work... but thanks anyway! Jul 05 '11 at 07:46 AM Ananta To clarify by example, you can have a "tummy" bone attached to you "spine" bone, and scale the tummy to make the character fat, without affecting other bones (since none are connected to the tummy bone). Jul 05 '11 at 07:56 AM Waz Also note that performance is more affected by the number of bones which actually affect any skin vertex than by the total number of bones. Jul 05 '11 at 07:58 AM Waz All right, now I can scale spine by scaling tummy bone and without affecting other bones. And naturally fatted tummy mesh eat away at arms meshes... Yes "independently scale" is here, I am foolish. Jul 08 '11 at 02:11 AM Ananta add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users
 0 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? more ▼ answered Jul 04 '11 at 07:32 AM macs_yums 1 ● 4 ● 4 ● 4 This is a comment to the Question, not an Answer. If you could move it, that would help the indexing. TIA Jul 04 '11 at 11:56 AM Waz add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users
 0 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). more ▼ answered Jul 11 '11 at 12:52 PM Paulius Liekis 7.3k ● 16 ● 24 ● 45 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

By Email:

Topics:

x1279
x386
x143

asked: Jun 30 '11 at 06:05 AM

Seen: 1859 times

Last Updated: Jul 19 '11 at 07:15 AM