PDA

View Full Version : Animating a staff pivot point..(help!)


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

Rudity
04-20-2003, 09:48 PM
You can make a moveable pivot for the staff.
Group it twice, then get the first groups translation to control the second groups translation. Put a multiply divide inbetween that connection and have it multiply it by -1.
so where ever the top group moves, it will tell the bottom group to move the same but negative.
So now you just animate the group, and you can move the pivot.
It only moves cleanly when the rotations are zero'd out.
Give it a try.
You could make controlers for it too, by point and orient constraining the group to whatever you want controling it.

So maybe that helps.

Later
Rudity

SpaceFork
04-20-2003, 11:07 PM
Hey, thanks Rudity, I'll give that a shot.

SpaceFork
04-20-2003, 11:50 PM
Well, I tired out your suggestion Rudity, but it doesn't look like its going to give me the results I want... since, as you said, it only really works when the rotations are zero'd out. The effect I'm going for is to be able to move the pivot point "on the fly"(to one of 5 locations) so that the staff can be rotated or spun and then have it's pivot switched to a new location along the staff to allow it to pivot around that new center. Your suggestion above only really allows me to change the pivot once in the beginning which, as far as I can tell, is basically the same as just hitting insert and moving it myself. Am I looking at this wrong?
Thanks,
-Mike

CGTalk Moderation
01-14-2006, 10:00 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.