Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Speedometer for moving objects.

  • Speedometer for moving objects.

    Posted by Reuben Isaac on February 11, 2014 at 6:11 pm

    I am working on a large animation that has birds flying across the screen. The birds are at varying distances from the camera causing their perceived speed to be different based on how far away they are; the farther away, the slower they appear to move.

    In order to keep the speed of the birds accurate and consistent I created a null object (called “Speedometer”) with a slider control for each bird. I then created null objects for each bird (called “Speed Tracker [#]”) I then copied the the position attribute from the bird to the Speed Tracker but offset it it by one frame so that the speed tracker is always 1 frame behind the bird. I then used the following expression to determine the speed.


    point1=thisComp.layer("Speed Tracker 1").transform.position;
    point2=thisComp.layer("Body Rig 1").transform.position;

    delta=sub(point1, point2);

    length(delta);

    By doing this, I find the distance from where the bird is to where the bird was over the course of 1 frame thus I get a speed of “X Px/Frame”

    Now, while this does work effectively, it isn’t exactly efficient and is a bit clumsy. Is there a better way to accomplish this?

    Dan Ebberts replied 12 years, 3 months ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    February 11, 2014 at 6:36 pm

    How about:

    thisComp.layer(“Body Rig 1”).transform.position.speed;

    Dan

  • Reuben Isaac

    February 12, 2014 at 4:34 pm

    Thanks Dan, however, when I try that I get a message saying that ‘speed’ does not exist.

    “After Effects warning: property or method named ‘speed’ in Class ‘Group’ is missing or does not exist. It may have been renamed, moved, deleted, or the name may have been mistyped. A property expression refrencing it was disabled.”

  • Dan Ebberts

    February 12, 2014 at 6:10 pm

    The expression I posted initially had an error, so I did an edit, but you may have picked up the first version. I just tried this, and it should work:

    thisComp.layer(“Body Rig 1”).transform.position.speed

    Dan

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