Next we will add a Custom Attribute to the
Bipeds Hand, this will drive the location of the ball. We are going
to create a spinner for the bipeds right hand. A value of Zero will
mean that the ball is at the location of the target. A value of 100
will have the ball rest in the hand. 50 will put it smack in the
middle.
Select the Bipeds right Hand (Bip01 R Hand)
and add a Attribute Holder modifier.
*If you don't have it already in your
StdPlugs\Stdscripts directory (then you can see it as one of the
Modifiers) you can simply run the script (MAXScript/Run Script: its located in
Scripts\Plugin Scripts, its called Modifier- Attribute Holder) I
recommend copying the file to the StdPlugs\Stdscripts directory,
that way it will be there every time you start Max. ( You will need
to restart max the first time its moved.)
Under the Animation menu, (with the attribute holder selected on the modifier
stack) goto Add Custom Attribute.
Change the Name to Right Hold Ball, make sure the Add
Attribute to Type: is set to Objects Current
Modifier. This insures that the attribute will be added to
the Attribute Holder Modifier. Leave everything else as it is and
click Add. The modifier stack for the
Bipeds right hand should look like this:
We can spin the value for the Right Hold
Ball, but nothing happens. Sorry, its not that easy. Now we will
assign some Attributes to our hand which will drive the balls
position relative to the 2 targets. Do me a favor. Pay
attention.
Select the Bipeds Right hand. Right click
and goto Wire Parameters. Run down the path of Modified Object/Attribute
Holder/Custom_Attributes/Right Hold Ball. You then move the
cursor and select your Right Ball Point
Object. This time, select : Transform/Position/Position Constraint/Position Weight
0 as illustrated.
You will be presented with the Parameter Wiring Dialog. What we are doing here
is setting up a connection between the Right Hold Ball Spinner value
on the bipeds hand with the weights (influences) of the two targets.
Connect the Attribute (Right Hold Ball) to Position Weight 0 of the Right Ball position constraint. Select one way
connection and click connect. Leave the dialog
open.
We want the slider (Right Hold
Ball) to control the entire range the ball has, from hand to target.
To do so, we must create an association with the second weight
(weight 1) which is the Hand R Target. Select Position Weight 1,
create another one way connection.
What we want in this instance,
is to change the expression to 100 -
right_hold_ball . This insures that the relationship between
the 2 constraints is inversely proportionate, so that when one is at
0, (no influence) then other is at 100 (total influence) and
vica-versa.
Experiment with the slider, you
can see how the ball easily goes from hand to target. So far, so
good. Adjust the slider, move the bipeds hand, move the target. All
goes as smooth as warm butter. Don't pat yourself on the back too
hard just yet. You're not done.