Maya for 3D Printing - Rapid Prototyping
In this course we're going to look at something a little different, creating technically accurate 3D printed parts.
# 1 14-02-2006 , 08:21 AM
Registered User
Join Date: Dec 2005
Posts: 11

time delay

Hi,

I tried to follow the instructions in a tutorial about the making of a tail which uses a mel needed to delay the movement of joints, but when I run the mel Maya returns a syntax error. If I change the character ' with " the mel is accepted, though it still not works. This tutorial is a demonstrative part of a chapter about rigging which I've found in a site of books selling.
Is someone able to figure out what's the problem? Any help will be appreciated since I don't get it at all.
Thanks in advance.

Here's the mel:

int $time = 'currentTime -query';
int $delay10 = 'getAttr -time ($time - 10) Hips.ry';
int $delay20 = 'getAttr -time ($time - 20) Hips.ry';
int $delay30 = 'getAttr -time ($time - 30) Hips.ry';
int $delay40 = 'getAttr -time ($time - 40) Hips.ry';
TailRoot.rotateZ = 0 + Hips.rotateY;
Tail2.rotateZ = 0 + $delay10;
Tail3.rotateZ = 0 + $delay20;
Tail4.rotateZ = 0 + $delay30;
TailEnd.rotateZ = 0 + $delay40;

# 2 15-02-2006 , 02:31 AM
skywola's Avatar
Registered User
Join Date: Jan 2004
Location: Tempe, Arizona, USA
Posts: 224
Tis but a common error, which happens amoungst those still learning MEL . . . You are using the ' instead of the ` !!!

you may want to avoid also, in the future creating variables named after MEL functions, i.e., try avoiding the use of "$time"
as getting into the habit of doing that could cause some nasty bugs in your program, and make your code confusing too.

It would be ok to do something like :

int $time01 = `currentTime -query`;

Then it is obvious that it is not a MEL function.


"The Sage as an Astronomer: If you still see the stars as something above you, you lack the eye of knowledge." Friedrich Nietzsche
# 3 15-02-2006 , 03:18 AM
skywola's Avatar
Registered User
Join Date: Jan 2004
Location: Tempe, Arizona, USA
Posts: 224
A much easier way of accomplishing what you are trying to do is use the expression editor . . . . it will be your friend if you learn it . . . . you will want to use joints to control the tail, if you are doing animation . . . . this is how I would do it . . .


Create a group of joints, for simplicity, we will say joint1, joint2, etc.

joint2.rotateY = joint1.rotateY *1.1;
joint3.rotateY = joint2.rotateY *1.1;
joint4.rotateY = joint3.rotateY *1.1;
joint5.rotateY = joint4.rotateY *1.1;

So each joint rotates a little more than the previous. When you rotate joint1, it rotates all the other joints via the MEL code.

If you open up the expression editor in the file I have attached and select joint2, then look at "rotateY", you will see the code.

This code is MUCH simpler that whoever-it-was that was trying to write a tutorial . . . and simpler is better and easier to tweak if you need different results . . .

Attached Files
File Type: zip tailexp.zip (107.5 KB, 541 views)

"The Sage as an Astronomer: If you still see the stars as something above you, you lack the eye of knowledge." Friedrich Nietzsche
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads