Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Dan’s gravity expression, creeping object

  • Dan’s gravity expression, creeping object

    Posted by Mike Clasby on July 18, 2006 at 5:11 pm

    This is for Dan if he’s around and not on vacation.

    I’m using your gravity expression from this earlier post, and I would have swore it worked before, when I first copied it down, but now it’s very weird. The object never stops moving, it just creeps along the floor (x direction), the only way I can get it to stop is by setting the initial x velocity (VxO)to 0. In other words it keeps that initial velocity forever. Am I doing something wrong? I have AE6.5, is this an issue over expression for an older version? Dazed and confused.

    Dan Ebberts
    Date: Oct 10, 2003 at 12:03:22 am
    Subject: Re: expression question with gravity and ‘the ground’

    Vy0 = 500; //initial y velocity (pixels/second)
    Vx0 = 100; // initial x velocity (pixels/second)
    g = 2500; // gravity (pixels/second/second)
    floor = 400;
    e = .85; //elasticity

    b = floor – position[1];
    h = b + Vy0*Vy0/(2*g);
    T = Vy0/g + Math.sqrt(2*h/g);

    if (time < T){ y = Vy0*time - g*time*time/2 + b; }else{ Vy = -(Vy0 - g*T); while (true){ Vy *= e; t = T; T += 2*Vy/g; if (time < T){ t = time - t; y = Vy*t - g*t*t/2; break; }else if (T - t < thisComp.frameDuration){ y = 0; break; } } } [position[0] + Vx0*time, floor - y] PS.I was going to drop this post on the CottonBall question just below, but can't get it to work right, and before I saw he's trying for a 3D.

    Mike Clasby replied 19 years, 10 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    July 18, 2006 at 7:52 pm

    Mike,

    I doesn’t look like the expression has any friction or damping for motion in the x direction – as you’ve discover it just keeps moving at a constant velocity. Let me give it some thought.

    Dan

  • Dan Ebberts

    July 18, 2006 at 8:16 pm

    Try changing the last line to this:

    [position[0] + Vx0*(-Math.pow(2,-time) +1), floor – y]

    You may have to crank up the initial x velocity.

    Dan

  • Dan Ebberts

    July 18, 2006 at 8:45 pm

    In this setup, Vx0 becomes (in pixels) how far the object will move in the x direction. The first parameter of Math.pow() determines how quickly it will get there, with 1.0001 being very slow and 10.0 being very fast (I think).

    Dan

  • Mike Clasby

    July 18, 2006 at 9:07 pm

    Dan, I don’t understand about the 1st parameter (or any parameter for that matter) of the Math.pow(), but Thanks, for the new toy to play with. I tought I was going crazy there for awhile with my perpetual motion object.

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