SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.

Home / forum / Animation / Mel Scripts & Programming / Walkerman's addBodyCode Procedure
Register FAQ Members List Calendar Mark Forums Read

New Thread
 
Thread Tools
Old 10-03-2006, 11:12 AM   #1
skywola
Registered User
 
skywola's Avatar
 
Join Date: Jan 2004
Location: Tempe, Arizona, USA
Posts: 224
Thanks: 0
Thanked 0 Times in 0 Posts
Default Walkerman's addBodyCode Procedure

This is the third procedure called, in the Walkerman program.

If you are stepping thru Walkerman with the script editor, you would be doing this:

int $n = 1;
addSkeleton($n);
addAttributes($n);

Then we come to this procedure:

global proc addBodyCode (int $n){


Here we are just building strings so we can use them later in the code. . . .
// BODY JOINTS
string $bb = "bb" + $n; // gives "bb1"
string $hc = "hc" + $n; // gives "hc1"
string $hl = "hl" + $n; // gives "hl1"
string $hr = "hr" + $n; // etc . . .
string $ls = "ls" + $n;
string $rs = "rs" + $n;



Now the FUN part . . .

Here we build the string we need to add the mathematical coding for the expression we want.

string $exp1 = $hl + ".rotateZ = " + $hl + ".legSpread + tan(" +
$bb + ".clock * " + $hc + ".hipSwing/" + $bb
+ ".initYposition - .5)-5.74;";

Not a wide enough window to show the expression properly here, but it builds to a string:

hl1.rotateZ = hl1.legSpread +
tan(bb1.clock * hc1.hipSwing/bb1.initYposition -.5)-
5.74;


Now we actually create the expression:

expression -s $exp1 -o hl -ae 1 -uc all;



Jumping to a easier expression:

string $exp3 = $ls + ".tx = -"+ $rs + ".tx;";

builds the string:

ls1.tx = -rs1.tx;

Then we create the expression:
expression -s $exp3 -o rs -ae 1 -uc all ;


Everything that follows is basically the same functions being repeated to create coding for all the joints in the body. . . . and lots of fun stuff like MATH - a fun can of worms to open up if you have the time and patience. . . .


Keep in mind that the code

ls1.tx = -rs1.tx;

could also be:

ls2.tx = -rs2.tx; or ls4.tx = -rs4.tx;

Depending on which character number you are building.

Then we want the parent of all the joints selected as we exit the procedure . . .

select -r $bb;

}

The only complicated part of this procedure is the math . . . .
Building the sttings for the code can be a pain too, but you can print the expressions out in the script editor to see what they look like and then edit them as needed.
__________________
"The Sage as an Astronomer: If you still see the stars as something above you, you lack the eye of knowledge." Friedrich Nietzsche
skywola is offline   Reply With Quote
New Thread

« Previous Thread | Next Thread »

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

1 Month

$34

Month-to-month billing
$34/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
 
 

3 months

$87

Billing every 3 months
$29/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $5 per month or $15 in total compared to monthly billing with this package.

12 months

$288

Billing every 12 months
$24/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $10 per month or $120 in total compared to monthly billing with this package.

Your plan will automatically renew. You can cancel at any time via your PayPal account to avoid being charged again.

You can view the FAQ on our video plans here. You can contact us directly here. By clicking one of the buttons above, you agree to our Terms and Privacy Policy.