View Full Version : rotating the pole vector?
JasonA 08-11-2003, 06:17 PM I'm wanting to set up a locator for a pole vector on a leg, but what I'm noticing is that the pole vector for my ikhandle is pointing in the opposite direction from where I need the pole vector locator to be. I'm not sure why it happens but everytime I set up the ik through the leg joints, the default pole vecotr points in the opposite direction it should. So when I constrain the pole vector to the locator, the skeleton moves out of place :( argh.
Well I don't want to have to place the locator on the other side of the leg (which is a work around). Is there a way I can 'rotate' the default default pole vector 180 degrees before constrianing to the locator without messing up the bone system?
Or do i have to rebuild the leg bones? If the latter, is there something I need to be looking out for when creating the bones so that I get a pole vector pointing in the right direction from the get-go?
|
|
cavetroll
08-13-2003, 12:25 PM
howdy.
try the twist attribute on your ik-solver and set it to 180 if your pole vector flips after you did the constrain to the loactor. also make sure that you did constrain your locator to the knee and then local-transform it to the place you want it to be. otherwise you will get a slight offset in your bone system when doing a poleVectorConstraint.
hope that helps.
SpaceFork
08-13-2003, 07:16 PM
Hey there, I've heard that you generally don't want to use the twist attribute workaround...but I don't know why (maybe someone else will chime in). When I would get this problem it was usually because I didn't setup the joint chain properly, I just placed the bones and went from there. If you detach the pole vector, freeze transformations on the joint chain, and then set their local rotation axis' correctly, the problem should go away.
nottoshabi
08-13-2003, 08:22 PM
Try seting the preferred angel on the joint before you apply the ik handle, that should fix your problem.
cavetroll
08-13-2003, 09:22 PM
yeah!
for some reason I also don't like strange workarounds for getting alignments right. you will never now if they will work or tear your rig apart one day...
never had any problems with my upVectors behaving correctly if I get the alignment of my (can I say?) joints right. ;)
cheers.
ACFred
08-24-2003, 01:05 AM
How are you positioning your locator? If it's not dead-on in relation to your pole vector, you'll see some movement.
There are simple math formulae to make sure that the locator is positioned properly before applying the pole vector constraint.
Alec
SpaceFork
08-24-2003, 08:46 AM
There are simple math formulae to make sure that the locator is positioned properly before applying the pole vector constraint
Would you happen to know these formulae, and could you please share them with the rest of the class?
ACFred
08-24-2003, 06:46 PM
Sure.
First, get the worldSpace translation values of what I call "$topJoint", which is typically the shoulder in an arm RP-IK setup.
float $topJoint[3];
$topJoint = `xform -q -ws -t topJoint`;
Then, get your pole-vector coordinates that are automatically created with your RP-IK.
$pv[3];
$pv = `getAttr ikHandleName.pv`;
normalize $pv;
So, all you have to do now is figure out an offset value -- some number that we'll use to move the pole vector control back in space a bit so that it better fits our character. We'll use 5 in this case.
Finally, we do the following to get the pole vector placement coordinates:
float $pvLoc[3];
$pvLoc[0] = $topJoint[0] + (5 * $pv[0]);
$pvLoc[1] = $topJoint[1] + (5 * $pv[1]);
$pvLoc[2] = $topJoint[2] + (5 * $pv[2]);
Then, if you just assign those values to whatever you want to use as your control object. Say you want a sphere to do that job, you'd use:
sphere -p $pvLoc[[0] $pvLoc[1] $pvLoc[2];
Select your sphere and IK handle, create a pole vector constraint, and you're good to go.
Let me know if something's not clear and I'll try to explain it better.
Good luck!
Alec
SpaceFork
08-24-2003, 07:04 PM
Thanks Alec, thats great.
nottoshabi
08-25-2003, 03:12 PM
Originally posted by ACFred
Let me know if something's not clear and I'll try to explain it better.
:surprised
Can you start right after you said: Sure
ACFred
08-25-2003, 05:41 PM
Explain everything, huh? Well, first, let me know if you program in MEL or not or ever intend to.
While I could go on explaining about the fundamentals of MEL, the creation of variables & arrays, procedures, etc., it might not do any good if you have no intention of getting that far into it.
Essentially, the formula is saying this:
To find a good location for your pole-vector controller, add the worldspace X position of the pole vector with the worldspace X position of the shoulder --> x1 + x2.
Do similarly with Y & Z.
To offset the controller, just multiply x2, y2, and z2 by some number greater than 1.
Let me know if you would like more detailed description.
Alec
nottoshabi
08-26-2003, 07:18 PM
Alec thanks for the explanation, I would like a little more if you have time.
Its starting to come together but its still a little fuzzy. I understand the process but its hard to put in to process. Mel is wonderfull, but those dam comands are hard to remember. I have duplicated the problem Jason had and ran the script that you had posted and came up with:
// Error: Syntax error //
// Error: sphere -p $pvLoc[[0] $pvLoc[1] $pvLoc[2]; //
// Error: Syntax error //
Witch dont what it means.
CGTalk Moderation
01-15-2006, 08: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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.