PDA

View Full Version : joint chain from a curve


carsonmorton
10-10-2008, 06:53 PM
Is there a tool in Maya that lets you create a joint chain on a curve without actually making you draw the joints? (with options for number of joints, if the chain is controlled by the curve, ect)

sj_bee
10-13-2008, 11:00 AM
something like this?

global proc string[] foo(string $curveName, int $numBones)
{
float $param = 0.0;
float $paramStep = 1.0/$numBones;
string $shape[] = `listRelatives -f -s $curveName`;

vector $position;
string $joints[];
int $counter = 0;
while($counter <= $numBones)
{
$position = `pointOnCurve -top 1 -pr $param $shape[0]`;
$joints[$counter] = `joint -p ($position.x) ($position.y) ($position.z)`;

$param += $paramStep;
$counter += 1;
}
joint -e -oj xyz -secondaryAxisOrient yup -ch -zso $joints[0];

return $joints;
}

eg
string $curve = `curve -d 3
-p 0 0 0
-p -0.822222 0 -1.133333
-p -2.466667 0 -3.4
-p -2.133333 0 -10.4
-p -1.377778 0 -13.466667
-p -1 0 -15
-k 0 -k 0 -k 0 -k 1 -k 2 -k 3 -k 3 -k 3` ;

foo $curve 8;

CGTalk Moderation
10-13-2008, 11:00 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.