Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Using valueAtTime() (3D position) and toComp() together?

  • Using valueAtTime() (3D position) and toComp() together?

    Posted by Jared Flynn on November 17, 2010 at 6:20 am

    Hi there,

    I’m working on motion graphics for a documentary about stock car racing, and one element of the package has me placing small dots (representing cars) on a map of the racetrack, which is rotating in 3D space.

    We’re isolating just one car out of the forty or so cars in the race, and the only distinction we need to have between them is their current ranking (1st place, 2nd, etc). So I figured, no problem, just make a motion path, apply it to a 3D Null laid over the track, and use the toComp() method to pin my 2D dot-icons to the Null, offset over time to make a line of cars going around my track.

    Because there are so many cars, though, I’d really like to avoid duplicating my motion path Null forty times and offsetting them, only to have to ALSO duplicate all my car icons and pin them to all those corresponding Nulls. I’d hoped to use the valueAtTime() method within each icon’s Position property to offset the position of the 3D Null AND the toComp() method to derive a 2D position from that offset value at the same time, but AE is having none of it.

    Is there a way to get that idea working, or am I stuck making eighty layers (40 motion path Nulls and 40 car icons) in order to achieve this look?

    I post my best attempt at it below. This would go into the Position property of each 2D car icon, ideally to trace back my single 3D Null’s position in 3D space over time and derive a set of 2D coordinates from that. I know the code’s broken but my hope is that it more simply explains what I’m after. In case it helps, the code below returns an error saying that “the function offsetPos3D.toComp() is not defined.”

    Thanks for looking!

    offsetPos3D = thisComp.layer("carPosition").position.valueAtTime(time - (0.1 * index);
    // Takes the carPosition null's 3D position as of 0.1 seconds
    // ago (times the value of the previous layer's offset, so we
    // make a sequential line of icons)

    offsetPos3D.toComp([0,0,0])
    // Converts that offset value to 2D coordinates for this
    // icon's position

    Jared Flynn
    Motion Graphics Designer / Lead AE
    Lone Wolf Documentary Group

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

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