Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Using expressions to constrain IK limbs?

  • Using expressions to constrain IK limbs?

    Posted by Stephanie Benvenuto on April 5, 2007 at 2:52 pm

    So the students in my class are now learning how to use IK limbs on their 2D puppets in After effects. But one question was how to keep the toe of the foot from going beneath the floor plane when the body moved forward.

    The only way I could think of was to put a null object’s anchor point at the toe (as a locator), then use the clamp expression to tell it not to go below the floor (the anchor point for the foot itself is at the ankle). Then I would somehow tie the foot to the locator (but I can’t parent it because its parented to the calf). I could maybe have that locator be the driving mechanism for the foot rotation too.

    I’m just not sure if the clamp expression is the right one to use to tell it not to go under the floor. Is the another better expression out there for that? Also how does one tie the far end of an object (not the anchor point end) to another object?

    Thanks for any help.

    Dan Ebberts
    replied 19 years, 1 month ago
    2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    April 5, 2007 at 5:10 pm

    What you want to do can likely be done, it’s just hard to say how though, without seeing what you have so far.

    Dan

  • Stephanie Benvenuto

    April 5, 2007 at 5:51 pm

    As it turns out, its your IK script that we’re using. I just realized that now. I did change it to include a control layer, so they don’t pull the foot. I put the anchor point for the control at the same place as the ankle joint (null object) and the foot anchor point. The foot is parented to the calf. And this is now the code for the calf:

    B = toWorld(anchorPoint);
    L = thisComp.layer(“right_thigh”);
    A = L.toWorld(L.anchorPoint);
    L = thisComp.layer(“right_ankle”);
    C = L.toWorld(L.anchorPoint);
    L = thisComp.layer(“right_foot_control”);
    H = L.toWorld(L.anchorPoint);
    a = length(A,B);
    b = length(B,C);
    c = length(H,A);
    x = (a*a – b*b + c*c)/(2*c);
    y = c – x;
    alpha = Math.acos(clamp(y/b,-1,1));
    beta = Math.acos(clamp(x/a,-1,1));
    radiansToDegrees(alpha + beta);

    So far there are no expressions on the foot. It is simply parented to the calf. Let me know any other information you need. Thanks.

    -Stephanie

  • Dan Ebberts

    April 5, 2007 at 6:33 pm

    You might parent a “heel” and a “toe” null to the foot and use something like this:

    floor = 400; // y coordinate of floor
    L = thisComp.layer(“right_heel”);
    P1 = L.toWorld(L.anchorPoint);
    L = thisComp.layer(“right_toe”);
    P2 = L.toWorld(L.anchorPoint);
    maxY = Math.max(P1[1],P2[1]);
    if (maxY > floor){
    value – [0, maxY – floor]
    }else{
    value
    }

    Dan

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