PDA

View Full Version : Automated Leg Setup MEL Problems.


JellyFire
12-15-2005, 02:58 AM
Hi there.
I've gone through the CGToolkit "art of rigging" book, I am going to make some automated rig scripts and started with the example, added a non Flip knee in there and were going to add some more stuff. HOwever on testing it out I get a wierd result.
The ik joints shifts 90 degree's from the ankle, it's nothing to do with twist or offset, and the nurbs shape moves with it.
I've not very experience with MEL and as this is something to do with the vector world orientation (I think) i'm out of my league.

Can anyone take a quick look at it to see whats happening>?
Sorry for inconvenience.
Jellyfire.

M.E.L.
12-15-2005, 03:20 AM
the errors are stemming from the orientation constraints... looks to me like they have become a bit screwed up when running the script. I can get the joints back into position by inverting the constraint weights on the joints but that doesn't help as the IK's are already placed in the messed up position.

this is on Maya 7 btw.

-s

JellyFire
12-15-2005, 03:34 AM
Yeah I created the script in Maya 7,..
I'm going to look into how to fix it tomorrow, maybe get in touch with
the CGToolkit guys if there is no fix by weekend.
Thanks for your response!!!

JellyFire.

kiaran
12-15-2005, 07:48 PM
Hi JellyFire,

I ran the script and it errored-out on line 232. Looks like you forgot to specify the driver attribute on a set driven keyframe command. This is the line I'm talking about:

setAttr ($legSide + "footControl.toeTap") 10;
setAttr ($legSide + "toeTapGrp.rotate" + $footAxis) (90*$isFootNegative);
setDrivenKeyframe -cd ($legSide + "toeTapGrp.rotate" + $footAxis);

The reason the leg is twisted is because the script was interrupted before the SDK's for the reverse foot were complete. The toe group was rotated 90 degrees, but the script did not get to line 238 where it is set straight again, hence the twisted leg.

Make sure you display line numbers when you are scripting so you can tell where the script encounters an error.

Hope that helps you on your way!

Cheers :)

JellyFire
12-15-2005, 11:32 PM
Thanks Kiaran.
I love it how you guys are up for helping out people, most books you buy, if
you get stuck they don't want to know! so thanks for the response.

I noticed a few problems in that area of my script, but the main problem was
comming from me setting up the plus and minus node to the RP IK.
So I got rid of that and it solved my problem a bit, I think (I've got the flu,
so if I'm not making sense it because of that, but I'm trying my best :) )

Anyway, I then tried out your script and have a problem with it, i've had this
before, I thought making it my way would solve it, but obviously not.

The whole leg is set up perfectly fine, all the joints work, but the control object
rotates 90 degrees. This is just using the script straight from the DVD, Mac OSX 10.4
with Maya 7... There are no errors reported... Know how to fix it?

Thanks again for your support!!!
Jellyfire

kiaran
12-15-2005, 11:44 PM
The control object is oriented to the ball joint. Just find the block of code that does that and remove it if you want.

Most animators actually prefer IK controls that are aligned with the world, so you aren't alone.

If you really want to use this in a production (or just get practice writing MEL) I would recommend the following changes to the script:

1. Make it so that it isn't dependant on such strict naming conventions. You could have it so that the user selects the hip+toe joints before running the script. Then you can query the selection with the ls command to find what joints need to be setup.

2. Make the script actually create the control objects for you.

3. Make it modular so that it can setup just IK, IK/FK, IK/FK and reverse foot etc...

These are just off the top of my head, but any one of those features would be a great exercise for someone such as yourself who is becoming familiar with MEL.

JellyFire
12-16-2005, 03:03 PM
Thanks for your Help Kiran.
I'm having further problems though. Maybe it's this flu attacking my thought process??
I've managed to stop the foot control from alligning to the ball, however this directly effects the rotation of the IK joints. It twists the joint -45 degree's and stops all the toeTap from working etc... For instance the toeTap will move side to side instead of up and down...
I can compensate for this a little by changing the rotation of the set driven keys, but really I'd like this to be sorted in a proper way instead of a crap fix..

Any idea where I should look?
It is just the cgTkLegSetup script but with the foot controller bit looking like this.


parent ($legSide + "FootGroup") ($legSideLong + "FootControl");

select -r ($legSideLong + "FootControl");

FreezeTransformations;

performFreezeTransformations(0);

setAttr ($legSide + "LegIk.poleVectorX") 0;

setAttr ($legSide + "LegIk.poleVectorY") 0;

setAttr ($legSide + "LegIk.poleVectorZ") 0;

Sorry for dragging this out a bit :(
I can't figure it out, I guess I need more MEL experience.
But once it's sorted I'm going to add ontop of it to make my defaylt setup..
Just need this bit correct first..

Thanks for any further help you can give..
JellyFire

kiaran
12-16-2005, 06:07 PM
I'm sorry to say that I don't have a magic answer for you.

My only recommendation is that you complete the setup like you want using the GUI while meticulously writing down each step that you make. Only once you've got it working as you want should you even begin to start thinking about writing the MEL.

Don't try and change the setup through MEL, that's just a waste of time and a guaranteed headache.

Best of luck! :)

JellyFire
12-16-2005, 06:12 PM
OK thanks man!!! :)

I'll see what happens ,,
Later

Hezza
12-17-2005, 03:50 PM
Kiaran,

I have a quick question for you. I've recently worked through the leg setup exercises in your book and everything worked fine as described. My only query is with where the foot pivots from. I read near the end of the chapter that animators like to have the foot rotate from the ball. Not being an animator and only playing about with the leg setup i found it hard to rotate the foot down onto the floor as the foot goes through a walk cycle. Previously i'd set up legs to rotate from the heel so that when the foot rolls through it stays firmly stuck on the floor.

I have a screenshot at home of what i mean just can't post it right now as i'm at work.

So why do animators like to have the foot rotate from the ball? I'm curious more than anything really.

Apart from that i think the 2 books have been my best buy this year, slowly working through them but i've already had a couple of eureka moments where you've explained stuff in video's that i've always stuggled with. Mainly on soft binding character meshes, i always used to end up working in circles moving weights about.

Anyway, long rambling post.

Cheers
Hez

JellyFire
12-17-2005, 07:01 PM
Hi kiran (or any other masters of MEL :) )
Sorry to bother you further, hopefully this is the last time on this subject.
I woke up today feeling much better and my head was a bit clearer, then
I started getting on a role with MEL, I'm starting to get stuff easier and
am thinking of ways I can do things myself, it feels good :)

Anyway, I kinda thought of a fix for my problem, I know it's not the best
way to go around it, but with my limited abilities I don't have much choice.
So what I did was unparent the foot control and the footGroup to -parent
then set the rotations of the foot control back to 0 so it alligns the way I
want it, then I was going to snap my control back to the ball joint and re
group the footGroup to the footcontrol, then that would work and be cool.

However I've run into a problem on moving the control to the balls pivot.
Heres my script:

//UNPARENT FOOT CONTROL + FOOT GROUP, DELETE FOOT ALIGN
select -r ($legSideLong + "FootControl") ;
parent -world;
select -r ($legSide + "FootGroup") ;
parent -world;
delete ($legSideLong + "FootControlAlign");

//ROTATE FOOT CONTROL + SNAP TO BALL JOINT
select -r ($legSideLong + "FootControl") ;
rotate 0 0 0;

float $worldSpaceOfControl[];
$worldSpaceOfControl= `xform -q -ws -t ($legSide + "Ball")`;
move -a $worldSpaceOfControl[0] $worldSpaceOfControl[1] $worldSpaceOfControl[2] ($legSideLong + "FootControl") ;

It kinda works, but ends up 2 units off in Z I think, am I doing something wrong?
I checked that the axis of the ball joint was still in it's center and it was.
So I think it's somthing to do with what I've put in the xform area.
I've checked the MEL reference but no look.
Hopefully you can point me in the right direction (AGAIN) and I can have done with this script.

Thanks a lot for all your help so far!
You're support is really appreciated!
Hopefully this is the last time ;)
Later
Jellyfire

JellyFire
12-18-2005, 01:10 AM
LOL, I'm sat here with a big Smile on my face :D
I sorted it, I was just trying to overcomplicate it.
All I had to do was point constrain the foot control to the ball,
then delete it, so I used this.

delete `pointConstraint ($legSide + "Ball") ($legSideLong + "FootControl")`;

That worked perfectly, now I can sleep at night...
phewwww.....
Now I can customize it, fun :P
Later
Thanks again.
JellyFire

CGTalk Moderation
12-18-2005, 01:10 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.