Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions wheel turning script

  • wheel turning script

    Posted by Robert Gilchrist on November 12, 2020 at 12:41 am

    Hi all. I need a script that allows a wheel to roll the correct number of revolutions based on its radius and the distance it moves along the x axis. Im not proficient enough in code to do this yet. I do know that the circumference is the distance travelled in one revolution. A=πr squared. So if radius is 100 units then A equals 31415.93. Im not sure why, but if i move the decimal point 2 units to the left (314.15), this equates to the distance along the x axis my wheel should roll. Ultimately i want to be able to move it a distance with an ease to and have it decelerate its spin and grip the road accordingly. Coders please help.

    Robert Gilchrist replied 5 years, 9 months ago 3 Members · 3 Replies
  • 3 Replies
  • Filip Vandueren

    November 12, 2020 at 9:23 am

    Assuming it is the wheel itself that’s changing position, and not a parent, and that the scale is a 100% (you should factor the scale into the radius otherwise):

    radius = 100;
    (transform.position[0] * 360 / (radius*Math.PI*2)) + value;

    I added “+ value” so you can fine tune the starting rotation of the wheel by scrubbing the rotation value .

  • Trent Armstrong

    November 12, 2020 at 3:00 pm

    Filip is brilliant with expressions, so I don’t take anything away from this. But I did want to mention that the free DuIK Bassel.2 from https://rainboxlab.org/tools/duik/ has some really great tools for stuff like rolling, swinging, bouncing, and lots of other cool stuff.

  • Robert Gilchrist

    November 12, 2020 at 11:29 pm

    Thank you Filip I will copy that into my test this morning and let you know how I went. Thank you. And thank you Trent for the Duik tools link. I will look into them too. Im sure there will be some goodies.

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