View Full Version : Wheel rotation

 jbecana01 January 2008, 06:43 PMHello, does anybody know to setup a simple expression to rotate the wheels depending on the xz translation? I suppose this is a common task in animation but never had to do it before I'm trying using WDist, convert to rotation and adding the result to the pitch, but no way so far. Thanks in advance, Javier.
jgj
01 January 2008, 07:44 PM
I wrote a function plugin a while back which may be of help:

http://www.zoogono.com/plugindetail.cfm?pid=36

It can control wheels, such as on a car, wagon, etc., in addtional to tank treads, and can rotate the wheels correctly as the vehicle goes forward and backward, and during turns.

-Jim

Ulven
01 January 2008, 08:02 PM
I didn't think to check if there was a plugin/function for it, but here's the basic principle just using maths and the PathSoFar expression.

jbecana
01 January 2008, 09:19 PM
Thanks a lot Jim, I'll check the plugin tomorrow, looks like it has a lot of useful applications.
Thanks Ulven, I'm looking at your scene now, I think I understand most of it. When I approached it, I thought to use the movement of my wheel from one frame to another to calculate the increment in its rotation based in the distance travelled that frame, adding the result to the pitch channel, but my wheel only rotated in the first frame. I see you are calculating the distance from the starting point at every frame. I'm missing something in the way expressions are evaluated....
One interesting point is how the camera is aligned to the path... the camera points to itself in the previous frame, I would never think about it by myself... ¿What's the last argument in the function ? TargetTime(I_Am_A_Wheel,I_Am_A_Wheel,NOW+1,I_Am_A_Wheel) In the docs: "Selects the blend item in the scene" but don't get what it means. Anyway I've learned a lot with this simple scene, thank you.

Ulven
01 January 2008, 09:47 PM
I think the last argument is supposed to blend the effect in and out, but it should've been a channel selection instead really. Anyway, it didn't seem to matter what one chose, but it gave me an error when I input NULL.

JoeCosman
01 January 2008, 05:50 PM
also remember there is an expression called PathSegment, which measures between keyframes. if you set it to NOW and frame 0, it will measure the animation path from the start position. once you have that, you can pipe it into the pitch channel, or call it into another expression to convert values to rotation.

the example I tried was this:

PathSegment(Sphere,0,NOW)
--+Sphere::pitch
--+Sphere::pitch
--+Sphere::pitch

sphere is 1 meter around.

if you want to get really technical, you could also measure x and y distances and use the ol' pythagorean equation on there. X^2 + Y^2=Z^2, where Z is the distance it traveled.

-JoeC

CGTalk Moderation
01 January 2008, 05:50 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.

1