Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   time delay (https://simplymaya.com/forum/showthread.php?t=20246)

hi2all 14-02-2006 08:21 AM

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;

skywola 15-02-2006 02:31 AM

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.

skywola 15-02-2006 03:18 AM

1 Attachment(s)
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 . . .


All times are GMT. The time now is 11:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018