ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Menu / hover effect / 2D & 3D Layer / different spaces / cursor

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Dean Snider
Menu / hover effect / 2D & 3D Layer / different spaces / cursor
on Jan 12, 2017 at 3:03:21 pm

Hello everyone,

I would like to measure a distance between a 2D and a 3D layer but don't know how to deal with the right space transforms.

My setup looks like this:
I got a "master"-comp wich contains a 2D layer and a preComp wich again contains a animated camera and multiple 3D nulls. (the camera is a child of a null, wich is also a child of another null)

Master
> 2d layer (cursor)
> preComp (3D Scene)
> null
> null
> camera
> null
> null
> null
> ...

What would be the best way to check if the 2d layer in master comp is positioned near / above one of the nulls in the preComp? toComp / toWorld? (if possible, 2d layer should stay 2d)

Thanks in advance,
dean


Return to posts index

Dan Ebberts
Re: Menu / hover effect / 2D & 3D Layer / different spaces / cursor
on Jan 12, 2017 at 6:42:07 pm

Assuming you have Collapse Transformations turned on for the precomp layer in the main comp, it will probably look like this:

L1 = comp("preComp (3D Scene)").layer("Null 1");
p = L1.toWorld(L1.anchorPoint);
L2 = thisComp.layer("preComp (3D Scene)");
L2.toComp(p)


Dan



Return to posts index

Dean Snider
Re: Menu / hover effect / 2D & 3D Layer / different spaces / cursor
on Jan 12, 2017 at 6:54:05 pm

Thanks for the quick response.

Unfortunately it messes up the screne if I turn collapse on.
Is there probably antother way where I don't have to turn on collapse transforms?

Thanks again!


Return to posts index


Dan Ebberts
Re: Menu / hover effect / 2D & 3D Layer / different spaces / cursor
on Jan 12, 2017 at 7:10:59 pm

Try it this way:

L1 = comp("preComp (3D Scene)").layer("Null 1");
p = L1.toComp(L1.anchorPoint);
L2 = thisComp.layer("preComp (3D Scene)");
L2.toComp([p[0],p[1],0])


Dan



Return to posts index

Dean Snider
Re: Menu / hover effect / 2D & 3D Layer / different spaces / cursor
on Jan 12, 2017 at 7:25:14 pm

Thanks. The code above creates some strange coordinates.

But the following seems to work correctly:

obj = the null

obj_world_x = obj.toComp([0,0,0])[0];
obj_world_y = obj.toComp([0,0,0])[1];
obj_world_z = obj.toComp([0,0,0])[2];


Return to posts index

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