View Full Version : math problem with scaling rig

03-06-2010, 10:18 AM
I'm losing my minds over here with a rigging math problem I thought at first to be simple. here it is:
I'm trying to calculate the bend amount of a bendy leg based on measurements, on how close the heel is to the hips. so to put it simple, if the heel is at 0, it is, let's say, 10 units away from the hips, and the bend is zero. if it moves 10 units up, it touches the hips and I want maximum bend. (don't worry about how the bend is achieved btw, not important in this equation).
so, everything is simple, until we get to scaling the rig :D (which is not done with normal scaling, but measurements, unfortunately)

so the problem: if the rig is scaled so the heel goes from 0 to 20 instead of 0 to 10 (in order to touch the hips), the bending shouldn't change (meaning the heel is still at zero, but in a different point in space). but if I move the heel controller, it should change, in a scaled space - the bending that happened from 0 to 10 should now happen from 0 to 20.
anybody, any ideas? it must be a simple math problem, but I suck at math.

03-06-2010, 04:47 PM
You just have to multiply base measurement & scale

Eg. If base mea. is 10 & scaling in 2 it gives 20 & If base mea. is 10 & scaling in 0.5 it gives 5

03-06-2010, 09:23 PM
You just have to multiply base measurement & scale

Eg. If base mea. is 10 & scaling in 2 it gives 20 & If base mea. is 10 & scaling in 0.5 it gives 5

I'm afraid my problem is not nearly that simple. I'm not sure if I can even explain it properly... which is a problem... :D
I just realized that one issue here is that my scaling is not a multiplier, but an addition, basically an offset. for example at scale zero (default/no offset) the leg length is measured 10 units, which let's say is the default. scale/offset 1 would give a measurement of 11, because it adds 1 to the length of the leg.

so the measurement in fact keeps changing all the time, based on both 'scaling' the leg (which is just a translation of a parent of the heel controller, in Y, not scaling on all 3 axes), aaand translating the heel itself. but I only need to take into consideration the heel controller's movement, in a normalized space (0 to 10 in this case), and remove the effects of scaling. :\

03-06-2010, 10:51 PM
So, if i get this straight:

You have a leg, which you can change the length of the bones, and also move the heel down to stretch it also.

Well your'll need to force the entire length into one of the two domains ( actual length or heel movement)

Personally i'd do this - get the entire length of the leg. Reset the scale i.e the heel translation to 0.0 and scale the bones length to this new length.

The bend should be normalized to a range of t[0:1] based on the length im guessing of the leg.

03-07-2010, 07:02 AM
Can u send me a dummy file so I can understand much better I understand what u say now but it more essayer to find problem id rahulsg2901@gmail.com

Which software r u using??

Have u tried adding scale value but what the prob. After addition

03-09-2010, 07:07 AM
thanks eek & rahul,
I should have uploaded a file for people to see, cuz the rig is a bit unconventional. I'll do this tonight, when I get home. It'll be a maya file with a simplified version of the rig. I didn't have time to work on it for the past few days, so for now I'm still stuck on this problem :D
thanks for helping!!

03-09-2010, 04:01 PM
I'm attaching a simplified version of the rig, I cleaned it up a bit and only left one leg.
there are 2 keyframes on l_leg_ctrl tr Y, as well as 2 keyframes on l_leg_spine_ctrl rot X, showing the way this rig is supposed to work (I would have a null driving some SDKs ultimately, but that null should always go from 0 to 1, in order to drive the same animation, no matter the scaling). the scaling attribute is on the main controller.
thanks again for taking the time to look at this!

03-09-2010, 09:13 PM
I havent checked the complete scene to see how you are doing the calculations, but first thing I would do is have a scale attribute start from 1 instead of 0. So scale 1 means everything normal size and 2 mins double size. You can't do that relative measurement when you start with 0. e.g. if 0 is normal then what is double? 1 or 2?

And here is how I would do it,
For any distance starting from min to max bend goes from 0 to 1. So you have min=0 and max=10 initially and after scaling say it is min=5 and max = 20.
I would use a remapVal node and map min and max to 0 and 1 (i.e. normalized distance). So no matter what your range is you always end up getting 0 to 1 for your distance to drive your bend.

CGTalk Moderation
03-09-2010, 09:13 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.