View Full Version : [3DSMAX] Rigging a rotating gear on an IK controlled leg.

12 December 2008, 03:21 PM
Hey everyone.

A friend of mine modeled a steam-punk robot and I offered to rig it. Everything was going fine until I hit a wall. There are gears in the knee joint and the leg is controlled in IK.

My problem is that I need the upper gear to rotate in the opposite direction of the lower gear. I tried to wire parameter the gear to the lower bone of the IK chain. It does transfer the initial rotation value, but when it rotates it doesn't update this value, so the gear doesn't rotate. I tried the same thing with a dummy linked to the bone, a dummy with a position constraint and an orientation constraint, both did transfer their initial rotation value to the gear, but like the bone, it doesn't update.

I've attached a screenshot of the knee with the gears to make it more clear.

Thanks for your help!

12 December 2008, 03:56 PM
6 bits on the smal gear
12 on the big
ratio:12/6 = 2.0

Next get the transform space of the bones:

Rot = degToRad (quattoeuler ($lowerLegBone.transform * inverse $upperLegBone.transform)).x -- or the correct axis

With a script controller on the small cogs x rotation e.g we use:

Rot * 2.0


12 December 2008, 03:59 PM
That's MAXscript huh? I might need help on using that... MAXscript is the one thing in rigging that was never shown at my school. (I am trying to learn it by myself though, but I'm just beginning)

EDIT - My bad, I read too fast. It's a script controler. That, I know roughly how it works. (roughly... that's why I haven't tried it)

Thanks a bunch. If it works I'll let you know.

12 December 2008, 04:13 PM
Ok, I think I must be doing something wrong because I can't make it work. It still doesn't refresh the value of the bone's rotation when it moves.

Where exactly do I put "rot = degToRad (quattoeuler ($lowerLegBone.transform * inverse $upperLegBone.transform)).z"? I just want to be sure I'm doing the right thing here...

12 December 2008, 04:22 PM
You would add a script controller to the rotation axis of the small cog:

you would then either make two variables, pointing to the upper and lower leg as 'NODES' and find there transform space in the script controller window eg.

rot = degtorad(quatToEuler(low.transform * inverse up.transform)).x

rot * 2.0

**You can ofcourse use an exposeTM node to find the transform space and local values of a node relative to another node without doing the above math.

12 December 2008, 04:23 PM
Ok I really need my morning coffee... It works! Thanks a lot man.

If you ever come by Montreal I'm paying you a beer. I'm not joking.

12 December 2008, 09:50 AM
Just a beer? Its got to be worth at least a beer + a bag of pork scratchings.

CGTalk Moderation
12 December 2008, 09:50 AM
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.