FORUMS: list search recent posts

Alternative to toComp

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Navarro Parker
Alternative to toComp
on Jun 13, 2013 at 12:41:26 am

Is there an alternative expression to the standard 3D Null to 2D position code:

L = thisComp.layer("NULL");
L.toComp(L.anchorPoint)

I'm getting a strange behavior from a 3D null that moves so far off the screen, that the layer with this expression is moving off screen, but looping back around.


Return to posts index

Darby Edelen
Re: Alternative to toComp
on Jun 13, 2013 at 4:31:43 pm

I've seen this happen when the 3D Null moves behind the camera. In those cases I usually check to see if the 3D Null is behind the camera and if it is I move the result of the expression to an arbitrary off-screen location like [-3000,-3000].

That's a general idea that may work in a few different circumstances.

Darby Edelen


Return to posts index

Navarro Parker
Re: Alternative to toComp
on Jun 13, 2013 at 7:10:45 pm

What's the expression to check if a null is behind the camera?


Return to posts index


Darby Edelen
Re: Alternative to toComp
on Jun 13, 2013 at 11:46:36 pm

Here's a sample that uses the active camera and tests the layer the expression is applied to:


c = thisComp.activeCamera;
p = toWorld(anchorPoint);
cp = c.fromWorld(p);
if(cp[2] <= 0) behindCam = true;
else behindCam = false;


Darby Edelen


Return to posts index

Navarro Parker
Re: Alternative to toComp
on Jun 14, 2013 at 5:13:54 pm

Hey, I'm getting an error: expression results must be of dimension 2, not 1

Here's a test project file to illustrate the original problem (for anyone wondering):

http://www.mediafire.com/download/bk0grfxawg0059w/3Dnull-looparound.aep


Return to posts index


Darby Edelen
Re: Alternative to toComp
on Jun 15, 2013 at 7:09:03 pm

In your case you could apply this to the opacity of the "pre.Mini Marker" pre-comp:

c = thisComp.activeCamera;
L = thisComp.layer("Null E");
p = L.toWorld(L.anchorPoint);
cp = c.fromWorld(p);
if(cp[2] <= 0) 0;
else value;


This would make the layer invisible when it is behind the camera. The position values will still be incorrect but the layer will not be visible.

If you need the position to be offscreen then you can replace the position expression you're currently using with this one:

c = thisComp.activeCamera;
L = thisComp.layer("Null E");
p = L.toComp(L.anchorPoint);
cp = c.fromComp(p);
if(cp[2] <= 0) [-5000,-5000];
else p;


Darby Edelen


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]