View Full Version : stupid question

11 November 2003, 08:26 PM
Hi guys,

if I have an attribute that controlls the rotation of object a and b. Now could you also offset the rotation of object b from a through an expression????

Thanks in advance

11 November 2003, 02:41 AM
If I get you right,

//this would go in objA's rz expression:
float $rotation = controlObj.CustomAttr;
objA.rotateZ = $rotation;

//this would go in objB's rz expression:
float $rotation = controlObj.CustomAttr;
objB.rotateZ = $rotation + 25; // this is the offset part

11 November 2003, 06:09 PM
Originally posted by clarix
Hi guys,

if I have an attribute that controlls the rotation of object a and b. Now could you also offset the rotation of object b from a through an expression????

Thanks in advance

Hi zachgrachan

Thanx for the reply, but I am talking abt offsetting the time and not the rotation. They both have the same rotation but lets say object a starts at frame 1 and object b starts a few frame later.

Thanks again

11 November 2003, 07:47 PM
You could use a getAttr in an expression and get the value at a previous frame, then set "Always Evaluate" because you're not using a proper node connection when you do this.

"Always Evaluate" is reportedly buggy though. There's a type of node called frameCache (also, regrettably, buggy) that can store attribute values from a range of frames and hook them up to object attributes... that might be a better choice if evaluation speed is an issue.

-- Mark

11 November 2003, 10:32 PM
The frameCache node is great except that it does not update when you change the input (animation) curve. This seems to be a bug that Alias is not too eager to get rid off.

11 November 2003, 04:24 AM
sorry guys I am not dat familiar with mel:annoyed:

11 November 2003, 08:53 AM
You actually don`t need to be familiar with mel to use (well a little would be helpful) the frameCache node, just type in the command line:

createNode frameCache;

You can turn off "show dag objects only" in the outline so that you can see and select it there.
Then open your connection editor and load the new node to the right side of the window . Create a " driving object with keyframes, let`s say on translateY, load this object to the left side of the connection editor window and connect the translateY attribute on the left to the stream input on the right of your frameCache node. Now you have connected the animation curve to the frameCache you can check this connection in the hypergraph. In order to connect the frameCache to the "driven" object a little mel is helpful, in the command line type:

connectAttr -f frameCache1.future[5] locator2.ty;

connectAttr = command to connect Attributes
-f = forces the connection
frameCache1 = name of the frameCache node (might b other in your case)
future = if you want the driven object to have a positive (later) offset use future, if you want it earlier type "past" instead of "future"
[5] = is the offset in frames, must be an integer, greater or equal 0
locator2 = name of the driven object, might b another in your case
.ty= translateY the attribute you want to drive

Note that you can use only one attribute as driver per frameCache. If you wanted all three translate values offset you would need to create three frameCache Nodes. The thing has a major bug though. If you change your input animation curve, the frameCache node will NOT reflect (update) this change.
good luck

11 November 2003, 02:32 AM
Hi Buexe,

thanks for the reply and the offsetting works fine, but now dat offsetted object goes way off screen although they were supposed to have the same translation as the other one, but now I dnt have any controll over the speed and the translation.

Thanks again

11 November 2003, 08:57 AM
Maybe the object gets some double transformations? Or they have different scales? I dunno
c ya

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