PDA

View Full Version : spline IK not following curve


indestructibleman
02-20-2006, 07:03 PM
i've got a setup for an IK spine i've had good luck with previously. i have a spine and a curve with clusters that i've created.

the problem is, on this particular spine, whenever i create the IK, it just pulls the spine into a straight line. the first two clusters move the spine, but clusters three through five have no effect on the spine (they do move the curve).

this is the command i'm using. i've used this line on another rig that works fine.

ikHandle -n XXspineIK -sj XXspineaJNT -ee XXneckJNT -sol ikSplineSolver -ccv false -c XXspineCRV;

there are seven joints, including the end, and five clusters on the curve.

all of the joints have the X pointed towards the child joint and the Y pointing towards the front of the character.

any ideas?

john_homer
02-20-2006, 08:46 PM
post a scene.

.j

indestructibleman
02-20-2006, 09:08 PM
http://flavoroftheweak.com/stuff/problemskel01.ma

this is the skeleton with the curve.

i then do:
ikHandle -n XXspineIK -sj XXspineaJNT -ee XXneckJNT -sol ikSplineSolver -ccv false -c XXspineCRV;

and it pulls the spine straight.


this is the script i'm using to create the curve:


spaceLocator -n XXspineaCRVloc;
spaceLocator -n XXspinebCRVloc;
spaceLocator -n XXspinecCRVloc;
spaceLocator -n XXspinedCRVloc;
spaceLocator -n XXspineeCRVloc;


pointConstraint -n dummyCONST -offset 0 0 0 -weight 1 XXspineaJNT XXspineaCRVloc;
delete dummyCONST;

pointConstraint -n dummyCONST -offset 0 0 0 -weight 1 XXspinecRIG XXspinebCRVloc;

pointConstraint -n dummyCONST01 -offset 0 0 0 -weight 1 XXspinedRIG XXspinebCRVloc;
delete dummyCONST01;

pointConstraint -n dummyCONST -offset 0 0 0 -weight 1 XXspineeRIG XXspinecCRVloc;
delete dummyCONST;

pointConstraint -n dummyCONST -offset 0 0 0 -weight 1 XXspinefRIG XXspinedCRVloc;
delete dummyCONST;

pointConstraint -n dummyCONST -offset 0 0 0 -weight 1 XXneckJNT XXspineeCRVloc;
delete dummyCONST;

select -cl;

float $XXspineaCRV[]=`getAttr "XXspineaCRVloc.translate"`;
float $XXspinebCRV[]=`getAttr "XXspinebCRVloc.translate"`;
float $XXspinecCRV[]=`getAttr "XXspinecCRVloc.translate"`;
float $XXspinedCRV[]=`getAttr "XXspinedCRVloc.translate"`;
float $XXspineeCRV[]=`getAttr "XXspineeCRVloc.translate"`;

curve -n XXspineCRV -d 1 -p $XXspineaCRV[0] $XXspineaCRV[1] $XXspineaCRV[2] -p $XXspinebCRV[0] $XXspinebCRV[1] $XXspinebCRV[2] -p $XXspinecCRV[0] $XXspinecCRV[1] $XXspinecCRV[2]
-p $XXspinedCRV[0] $XXspinedCRV[1] $XXspinedCRV[2] -p $XXspineeCRV[0] $XXspineeCRV[1] $XXspineeCRV[2] -k 0 -k 1 -k 2 -k 3 -k 4 ;
//align CRV with spine//


select -r XXspineCRV.cv[0];
newCluster "-n XXspineaCLS -relative -envelope 1";
select -r XXspineCRV.cv[1];
newCluster "-n XXspinebCLS -relative -envelope 1";
select -r XXspineCRV.cv[2];
newCluster "-n XXspinecCLS -relative -envelope 1";
select -r XXspineCRV.cv[3];
newCluster "-n XXspinedCLS -relative -envelope 1";
select -r XXspineCRV.cv[4];
newCluster "-n XXspineeCLS -relative -envelope 1";

indestructibleman
02-20-2006, 09:17 PM
infuriatingly, the problem is not consistent. i currently have two maya sessions open.

on one session it works, on the other it doesn't.

...


ok, if i set the units to centimeters, it works. if i set them to meters, it doesn't.

it seems consistent. i can open the same file twice. in one case, i switch to cm, in the other i remain in m. when i change to cm it works.

does this make any sense to anyone?

john_homer
02-20-2006, 09:47 PM
try not using linear curves.

also you may want to look into optimizing your script with some loops etc..

ie (this is not actual code.. well most of it)

string $jointList[] = {"joint1", "joint2", "joint3"};

for ($aJoint in $jointList)
{
create a curve point at the location of the joint...
}


another tip..

snap 1 object to another with
delete `parentConstraint "master" "target"`;

rather than creating it, hoping maya gave it the name you specified then deleting it..

also to get the actual name of anything you have created, use...

string $result = `parentConstraint "master" "target"`;

then you can delete/whatever with...

delete $result;

.j

indestructibleman
02-22-2006, 06:28 PM
try not using linear curves.

doesn't seem to help. fortunately, for what i'm doing, changing units to cm doesn't seem to hurt at all.

another tip..

snap 1 object to another with
delete `parentConstraint "master" "target"`;

ooh, that's a good one, thanks. i'll be using that a lot. thanks for the string tip as well.

a lot of this is re-editing scripts that i wrote almost a year ago and i've got some really messy stuff in there.


-will

john_homer
02-22-2006, 10:13 PM
doesn't seem to help.

-will

hmmm, worked when I did it to your scene.. I cant see any reason you would ever want to use a linear curve for a spline IK...

the m -> cm thing probably ties into maya having bugs with its tollerances...

.j

CGTalk Moderation
02-22-2006, 10:13 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.