View Single Post
23-06-2006, 07:43 PM   #2
Xander-0
Registered User
 
Xander-0's Avatar
 
Join Date: Feb 2005
Location: This Place
Posts: 220
I don't see why so many people are rigid binding mechanical parts.... I personally find it much better to just put the parts into the joint chain heirarchy.
Which is what you're going to have to do here....

Good news is I've done this before. Bad news is its minorly complicated.... ish
I'll try and explain this like how I did it....

Oh, and before you start, complete the joint chain by placing a new joint at the 'ankle'. You're going to need it, and having four joints in the chain shouldn't generate any problems. So, effectively, you'll have two hip joints, followed by a knee and an ankle joint (the blank area is between the knee and the new ankle joint).

1) First step is to parent all the pieces (or, at minimum, those pieces that are directly affected) by placing them into the joint heirarchy. So, for a piece going from, say, the hip to the knee, you place it in the hierarchy under the hip joint.

2) The piece that you want to be expanding, however, must be placed in the next joint down. So, if part of a leg between the knee and the ankle is supposed to expand, place it in the hierarchy under the ankle joint, NOT the knee joint (note, if you put in an ik joint at this point and move it around, you'll notice the piece moves wrong. Don't worry, that's fixed in the next couple of steps)

3) You're going to need a control curve. If the joint being affected is the effectively an ankle or wrist joint, this is seperate from whatever curve you should have for controlling ik handles. Anyways: Get a curve (probably a circle), and place it centered where the expanding joint is going to be (which in your case is I think the ankle joint) - that is, after the piece that will be moving is.... Put it into the joint heirarchy in this manner; after the upstream joint, and place the downstream joint into the circle. That is, here, put the circle into the joint heirarchy under the knee, and place the ankle joint into the circle (these last to should be at the same location)

4) you need another control curve! This one needs to observe two conditions. First, it should be the length that your joint can or should expand by (this is not necessarily the length of the actual piece itself). Second, it must be the path that your piece will follow during the expansion. In this case you seem to need a straight line, although I don't know how long. Put this curve as well into that same knee heirarchy

5) take a locator and 'motionPath' attach it to the expansion path curve. If you need to, reverse the curve direction - the starting location should be at the part where it expands from - here, the knee joint. Right click on 'uValue' and 'break connections'.

This step is purely optional. Useful if you want the rest location to be something other than the end of the curve, and if you want the posistion to be controlled by measurement referncing the global coordinates, rather than between 0 and 1.
6) If the 'rest' location isn't at one end of the control curve, you're going to have to monkey with MEL a little. The general form of the equation is : locator.uValue = (valDist + ("distance To 0 from end of curve")) / ("length of curve").
It is rather handy to have 'valDist' actually be a variable controlled from the iK handle control curve - it places it somewhere easily accesible, and makes it relatively easy to place a min/max clamp on it (although you don't really need one, given the way maya attaches things to curves....)

7) now, point constrain the ankle's circle to the locator. That is, first click the locator, then click the circle over the ankle (which should have the ankle joint inside its heirarchy). There should be no immediate change. But you should now be able to get the joint to expand by adjusting the locator's uValue. true, an ik handle that's attached won't immediately follow this location change, but it will still work, and the moment you grab and move the ik handle the rest of the chain will follow anyways.

only a couple of major steps left.
8) Remember that, because we parented the piece that expanded to the joint farther down the heirarchy, it didn't rotate properly if an ik handle was moved. we still need to fis that. this means two more constraints. First, you'll need yet another locator. Place it in line with the expanding joint, but otherwise centered in on the previous joint. That is, here, it should start out centered on the knee joint. If however, the expanding piece is off center, move it along whatever axis is necessary to line it up with that piece (so, either 'forwards' or 'backwards' in relation to the rest of the mech). Then, parent constraint the locator to the knee joint. Yes, you could put it inside the joint heirarchy, but we're doing something else with the locators later.

9) now, aim constraint the expanding piece to the locator that was parent constrainted to the knee joint. It may get a different initial rotation, but it should only be off in 90 of one direction or another - the point of placing the locator in line with it is to prevent odd aim directions, and bad posistioning when the joint expands or contracts.

your leg should now be ready to expand or contract. If you haven't already, create an iK handle to move the joint chain (yes, through all 4 bones). Also, create a curve to control the movement of the ik handle (center it more or less on the ankle). Parent the ik Handle to it, then hide the ik handle). also, group and hide all the locators. they shouldn't be moved in any case, and you don't really need to see them again. its also for that reason that I reccommend setting up a new attribute inside the ikHandle control curve, that can be read for the expansion of the joint

Anyways, its something like that. I probably ought to write a tutorial or something.... did that work for you?
__________________
Book Wise

http://X4nd5r.deviantart.com
  Reply with quote