Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Help: I need help. expression to rotate all 4 wheels of a can in 3D.

  • Help: I need help. expression to rotate all 4 wheels of a can in 3D.

    Posted by Mark Trethewey on May 20, 2009 at 3:26 pm

    Hi,

    I’m a long time Creative Cow reader, but a first time poster 🙂

    I recently completed Carl Larsen’s great tutorial on turning a wheel (pi.Math) in 2D along the x-axis.

    https://library.creativecow.net/articles/larsen_carl/vehicle_rig.php

    I am currently trying to build a 2d/3d car that could do this on all four wheels while turning and moving along in the x and z axis on top of a horizontal plane (ie, a road texture).

    How would I re-write this expression to output the speed of each wheel, while controlling the car’s position and orientation with a master node in the middle of the vehicle?

    Separately to this, I have been trying to work out how to get an oval shaped wheel (ie thinner width the height) to roll along the ground, in much the same way as the Carl’s tractor wheel but “sticking” to the ground – and then key the movement to show the wobble of momentum – but I am having no luck thus far. I’ll probably just end up simulating it in Maya, but I’m just really curious if it can be done elegantly in AFX.

    Unfortunately I’m not near my workstation, so I can’t post my expression attempts.

    Thank you to anyone who can help!

    Mark Trethewey
    DMI Productions
    https://www.dmiproductions.co.uk

    Mark Trethewey replied 17 years ago 2 Members · 3 Replies
  • 3 Replies
  • Filip Vandueren

    May 21, 2009 at 2:32 am

    The first part is not as trivial as it looks, because when you turn a car, all wheels start turning at different rotational speeds and this creates an offset. Both front wheels don’t even turn the same amount, I did a simulation of this once in Cinema 4D, let’s see if I can whip something up tomorrow…

    I’ll probably end up with a script that checks all previous frames, and translates the delta in position in every frame to an incremental rotation.
    So again, the sort of stuff AE is not that good at, but can be simulated.

    Oval wheels should be possible by divding the sin and cos or somehitng like that, I’ll check in tomorrow

  • Filip Vandueren

    May 21, 2009 at 7:24 am

    Here’s the code for the vertical position of a rotating oval wheel, which is actually just finding the radius of the oval at a given angle.


    r=degreesToRadians(rotation);
    w=content("Ellipse 1").content("Ellipse Path 1").size[0]/2;
    h=content("Ellipse 1").content("Ellipse Path 1").size[1]/2;

    radius=Math.sqrt(Math.pow(Math.sin(r)*w,2)+Math.pow(Math.cos(r)*h,2));

    [516,576] - [0,radius];

    I started with a shape Layer, so I could pick-whip to the width and the height of the ellipse.

  • Mark Trethewey

    May 21, 2009 at 9:28 am

    Great, thanks for that Filip! This is definetely of help.

    I’m now trying to control it in the same fashion as the wheel tutorial. Obviously the position is now locked to the rotation, so I’ve pickwhiped the [516,576] x and y values to a null’s x and y position values at this same position to re-gain control of the ellipse’s position and I will attempt to get it all going again. I figure, however, that the circumference is not even like a circle, so, it will slip too fast then too slow during each rotation. Hmmm….. can of worms 🙂

    Thanks again.

    Mark Trethewey

    Senior Designer
    DMI Productions
    http://www.dmiproductions.co.uk
    marktrethewey.blogspot.com

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy