Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Mario style camera

  • Mario style camera

    Posted by Flitch13 on May 3, 2007 at 6:21 pm

    Hi all!

    I am making a mario style animation where the camera keeps the subject in the center of the frame while he is going forward, but stops when he goes backwards.
    I can get the camera to follow no problem when he goes forward by linking the x position properties. My problem comes when I try to determine whether he is going forwards or backwards.
    Any help would be appriciated!

    Thanks.

    Flitch13 replied 19 years ago 3 Members · 4 Replies
  • 4 Replies
  • Kerryt

    May 3, 2007 at 7:40 pm

    you could try something like this.
    at the start of the script set x_max=x

    then in the update part you put this

    if x > x_max
    then xmax =x

    then link the camera to xmax not x

    that way x_max contains only positive and greater values of x, eg when x declines the camera stays at x_max

    hope that helps

    Kerry.

  • Flitch13

    May 3, 2007 at 8:11 pm

    thanks for the response. I sort of get the idea behind it, but am having trouble actually implementing it. I’m really new to expressions, so maybe if you could show me a sample code that would help a lot.

  • Filip Vandueren

    May 3, 2007 at 10:23 pm

    This works for me:

    expression for the camera’s position

    marioPos=thisComp.layer("mario").transform.position;

    progress=valueAtTime(0)[0];
    f=thisComp.frameDuration;
    for (t=0;t<=time;t+=f) { progress=Math.max(progress,marioPos.valueAtTime(t)[0]) } [progress,value[1],value[2]]

    as with many occasions a loop is needed that checks all the positions 'Mario' has been in since time=0

  • Flitch13

    May 4, 2007 at 1:38 am

    thanks! that worked perfectly

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