View Full Version : Expression Help

03-29-2004, 10:48 AM
Hopefully someone with some trigonometry skills can help me with this problem. I'm trying to tie the rotation of an arm to the rotation of a wheel, kind of like a railroad car. I want the arm to be fixed to a position on the wheel at one end, and a fixed point off the wheel at the other end. Check out the two picks to make it a little clearer.

What I tried is to parent the arm to a null, which is parented to the wheel. My first attempt at the expression was to tie the rotation of the arm to the sin of the rotation of the wheel plus a modifier. At 0, the arm should rotate 0, since sin = 0. At 90, the arm should rotate the modifier amount, since sin 90 = 1. But the arm seems to be waving back and forth rather than a smooth rotation to the modifier amount.
Can anyone offer any suggestions?

03-29-2004, 10:49 AM
Start Position:

03-29-2004, 10:50 AM
Position at 90 degrees:

03-29-2004, 11:32 AM
Just a couple quick searches.



There was a video tutorial on expressions that explains some but I can't remember where it was at.

03-29-2004, 11:34 AM
Why not just make a dual IK gizmo?

Have the green tube's IK pointing to the spot on the wheel, and the purple tube (a child of the wheel) pointing to the axis point of the green tube.

03-29-2004, 11:44 AM
and that's not always the case... but here we go...

Since one end needs to be fixed then I'm assuming you're going with some sort of piston-like contraption for the extenstion...
if that's the case I think you can solve the problem without delving into expression but with using IK...

If my assumption is correct then it should be pretty straight forward...
(I'm going with with the two piston objects in separete layers and Nulls as IK-Tip here but it could be done with bones)

With the two objects in separete layers, make sure the pivot point is at the center of where you want the rotation to be.
When you set it up, add two nulls and parent one to each piston.

Assuming they two to parts are aligned as they will be in the animation...
drag the null on the Z-axis for each part well over to the other side
(about 75% of the length.... I have no idea what I'm talking about... I'm just guessing...)

Then it is just a matter of setting up the IK.
IK for Pitch on the two layer piston objects and have each of the nulls use the opposite piston layer as a Goal.
Swith on fulltime IK.
Parent the rotating piston the wheel and you should be pretty much set...
and maybe tick off "unaffected by..." for the wheel...

Now as a last note... I don't know if this works... it works in my head and I'm hoping it will work in practise... Try it out and if it doesn't you could always come back and scream...

Good Luck and I hope it made sense...

03-29-2004, 11:51 AM
Like this...

(make preview animation from frames 0-250)

03-29-2004, 12:22 PM
Thank you guys!
The IK solution is much easier to set up, and much less of a hassel. All that trig stuff was starting to make my head hurt. Sometimes you just get stuck on an idea and need someone else to push you in a different direction.

Thanks again!