View Single Post
# 2 31-12-2007 , 01:05 PM
t1ck135's Avatar
Registered User
Join Date: May 2004
Location: UK
Posts: 1,991
Hi Trikeman,

If I understand correctly then the default behaviour of connecting the rotation with the translation gives far too much of a movement.
If so then the code way to do this would be to start without any connections between the objects and create an expression that is evalutated each frame and results in the rotation. You could then key the rotation in the desired frames.

To do this all you need to do is create an expression that gets the rotation of object 1, dilutes it to a much smaller amount and then apply it to the translation of object two.
Open up the expression editor and create a new expression using the following code:
Code:
$pObjValue = `getAttr "pCylinder1.rotateX"`;
setAttr pCube1.translateX ($pObjValue / 10);
Line one gets the x axis rotation of the named object
Line two sets the x translation of the named object to be the rotation divided by 10 (which simply dilutes the amount).
To use in your project simply change the names and the division to get the required effect. I would expect if it was a vice then the division would be far higher to give the impression that multiple rotations are needed to move the vice parts a small way.

I've also attached a sample movie showing it working so if need be you can take it apart or modify to suit. I think that if you have an earlier version of maya you will need to open it in notepad and change the version references to yours, e.g, changing 2008 to 7.0 or similar)

Simon

p.s, I split the code up so that it was easier to see but if you wanted a single concise line then the following does the job exactly the same:
Code:
setAttr pCube1.translateX (`getAttr "pCylinder1.rotateX"` / 10);

Attached Files
File Type: ma test_rotate.ma (62.4 KB, 539 views)

Examples of bTraffic - a traffic animation tool for Maya
bFlocking - a tool for Maya 8.5+ to generate flocking and swarming behaviours
Jan/Feb Challenge 2007 Entry and W.I.P
May/Jun Challenge 2006 Entry and W.I.P
Mar/Apr Challenge 2006 Entry and W.I.P
Jan/Feb Challenge 2006 Entry and W.I.P
Nov/Dec Challenge 2005 Entry and W.I.P
Sep/Oct Challenge 2005 Entry and W.I.P
Jul/Aug Challenge 2005 Entry
www.flash-fx.net

Last edited by t1ck135; 31-12-2007 at 01:11 PM.