Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression based Rig for a Mobile

  • Expression based Rig for a Mobile

    Posted by Andres Torres on June 16, 2009 at 3:21 am

    I’m trying to set up an expression-based rig for a mobile.

    The string the ball is attached to should rotate based on the weight and momentum of the ball.

    The white strings are solids with stroke applied to them and the 3D bar is Trapcode 3D Stroke. I’d also love the strings to bend and sway with the motion. I applied an AE tracker to track the tip of the horizontal bar.

    Filip Vandueren replied 17 years, 1 month ago 2 Members · 2 Replies
  • 2 Replies
  • Andres Torres

    June 16, 2009 at 5:05 pm

    Trying to figure out a way to rotate the lower white string based on the movement of the point where it’s attached to the blue arch.

    First I tried the Ponytail Physics by Filip Vandueren, but after playing with the variables, I couldn’t get realistic sway for the bottom string. This has promise though, especially if it used some of the math in the inertial bounce expression below.

    inertia = 0.8;
    stiffness = 0.25;

    lagValue = calcValue(0);
    f= thisComp.frameDuration;
    will=0;

    for (t=0; t<=time; t+=f) { delta = calcValue(t) - lagValue; will = will * inertia + delta*stiffness ; lagValue +=will } lagValue-parent.rotation; function calcValue(t) { p1=toComp(anchorPoint,t); p2=toComp(anchorPoint,t-thisComp.frameDuration); x=p1[0]-p2[0]; y=p1[1]-p2[1]; if (y>0) {
    y=y*5; // make *5 variable ?
    } else {
    y=y*0; // negative Y speed has no effect
    }

    r=x*2 + y; // make *2 variable

    return r;
    }

    Inertial bounce seems more realistic, but i can’t figure out how to calculate rotation of the lower string based on the position of the null it’s attached to.

    // Inertial Bounce (moves settle into place after bouncing around a little)
    n = 0;
    if (numKeys > 0){
    n = nearestKey(time).index;
    if (key(n).time > time){
    n–;
    }
    }
    if (n == 0){
    t = 0;
    }else{
    t = time – key(n).time;
    }

    if (n > 0){
    v = velocityAtTime(key(n).time – thisComp.frameDuration/10);
    amp = .05;
    freq = 4.0;
    decay = 2.0;
    value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{
    value;
    }

  • Filip Vandueren

    June 17, 2009 at 2:01 pm

    This stuff is notoriously tricky to emulate, you should break up the string in segments, each of which has inertia, lagging, bouncing + account for gravity, but this almost invariable breaks and the strings starts bungling in all kinds of weird ways.

    I used to try stuff like this in Cinema 4D’s Physics engine, and was very frustrated, let alone trying to code this from scratch in a javascript based language that has no concept of time…

    BTW: in most mobiles, the movement is more calm, and the strings would hardly move, centrifugal forces being lower than gravity and inertia. What’s ‘driving’ your motion in this example ?

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