View Full Version : Tail secondary movement

03 March 2004, 06:54 PM
Hi all,
I’m a long time observer, first time poster here on cgtalk.
My character has a spline ik tail. I know there is already a bunch of tutorials on this, but I want to create a satisfying automatic secondary movement for this tail. The results I have so far with particle or softbody dynamics are no good because they create a “springboard” effect, while im looking for a whip effect.
There is a solution I found in this book “Maya Character Creations”, it involves an expression:

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;

You can find the chapter that explains this expression online, halfway down this page:

I followed every step in the book from scratch, but I cannot get this expression to work. It gives me an error at every line of code. Is it because its not compatible with Maya 5? I am not too familiar with Mel and expressions but I have implemented some without any problems in the past. So please could someone show me how to make this work or suggest me something else.


03 March 2004, 05:42 PM
it looks to me like you are mistaking the single quote marks for being apostrophes. you want to use the key above the tab, not the apostrophe key when evaluating an expression. It's a common mistake and one thats hard to spot.
Your code should be:

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;

03 March 2004, 11:56 PM
it worked.
many thanks.

03 March 2004, 08:39 AM
A time delayed expression like the one you have here should yield a fairly convincing 'whipping' motion. I've used a similar expression to animate a sting ray.

Damb backticks/apostrophes will get you every time!;)

03 March 2004, 08:52 AM
instead of using mel in an expression, try using the frame cache node.

to create one: createNode frameCache;

then plug what you want into the node, and it will output the result of that node, but offset in time. much better than using mel in an expression...

03 March 2004, 11:07 AM
instead of using mel in an expression, try using the frame cache node.

You actually got that thing to work, Mac? Last time I tried it, it was just freakin´ out all ova´ da´ place. ...But I think that was in 4.5. Did they improve this in 5.0?

03 March 2004, 01:33 PM
pretty much the same for me.

in the help is written: output 1 is the stream's value at "frame + 1"....

but in the connection editor only past[0] or future[0] could be connected.

03 March 2004, 02:09 PM
No, I mean, I could connect everything no problem, it just behaved *extremely* erratically- it didn´t produce predictable or correct results. I think I tried it on some tail joints once, and the tail just kept twitching about hectically.

You might need to use MEL to connect it properly.


03 March 2004, 10:21 PM
yeah you're right, it does seem pretty finicky and unstable. it doesn't seem to refresh its own cache or something... i keep getting elements of old animation stored in the nodes.

maybe you're right dave, mel in expressions could be the way to go.

07 July 2004, 07:51 PM
No luck here either. Glad to know it's not just me. Where's Scheifer? He's the one who introduced me to this... how the heck did he make it work? If anyone else knows how to successfully use this node, please let me know.

Guess I'll have to use an expression for now, only days till Siggraph and the reel is still not ready for compositing.

- Jeremy

07 July 2004, 08:16 PM
Hi Jeremy,

you could e.g. try the lagNode... -->
lagNode and expressoUtils plugins (



CGTalk Moderation
01 January 2006, 06: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.