SpaceFork
04-20-2003, 08:22 AM
Ok, so I'm trying to animate a guy with a quarterstaff. Currently, parented to the staff are five locators representing different positions (center, left center, left end, right center, and right end). The character's arms are point constrained to the locators so that they can easily slide up and down the staff by animating the weight values. This works fine and dandy, but I also want to make my life easier by being able to change the pivot point of the staff (currently at center). My plan was to use a global procedure to do this instead of manually moving and keying the RotatePivotX(YZ) and the RotatePivotTranslateX(YZ). I wanted to make the procedure "snap" the pivot point of the staff to the position of one of the locators, but my extremely limited knowledge of MEL seems to be prohibiting this. Where I run into problems, is the line where the xform command is...I get a syntax error, and I can't seem to figure out why. The rest seems to work OK so far.
---------
global proc staffCenter (string $side)
{
if ($side=="RC") $side="RightCenter";
if ($side=="RE") $side="RightEnd";
if ($side=="C") $side="Center";
if ($side=="LC") $side="LeftCenter";
if ($side=="LE") $side="LeftEnd";
$loc = ("Staff" + $side);
vector $pos[]= 'xform -q -ws -rp $loc';
select -r Staff ;
move -r $pos[0] $pos[1] $pos[2] Staff.scalePivot Staff.rotatePivot ;
}
--------
Is this even a smart way to go about accompishing something like this, or is there a better way? If this is a good way to do it, then what am I doing wrong here?
Any help with this would be great.
-Mike
---------
global proc staffCenter (string $side)
{
if ($side=="RC") $side="RightCenter";
if ($side=="RE") $side="RightEnd";
if ($side=="C") $side="Center";
if ($side=="LC") $side="LeftCenter";
if ($side=="LE") $side="LeftEnd";
$loc = ("Staff" + $side);
vector $pos[]= 'xform -q -ws -rp $loc';
select -r Staff ;
move -r $pos[0] $pos[1] $pos[2] Staff.scalePivot Staff.rotatePivot ;
}
--------
Is this even a smart way to go about accompishing something like this, or is there a better way? If this is a good way to do it, then what am I doing wrong here?
Any help with this would be great.
-Mike
