Can I pass results from ' toCompVec ' expression to a parent comp?

New Here ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

Trying to work this out in my head how it would be possible.  I assume if it were possible it would be via Essential Graphics, but can't decipher what property needs to be "essential".

 

My end goal is to get a fully built Cube precomp (CYAN Label in GIF) into a comp with a camera (Brown Label), which will have many other cubes.  Need the sides for each cube to react/disappear via toCompVec expression.

 

Seems as right now, I can only get the toCompVec to work in the comp that has the cube-faces (CYAN Label).  Can I pass this data into another comp (Brown Label)?  Collapse transform doesn't work, obviously, but thought it would be possible when I initially conceptualized this in my head.

 

AfterFX_XGPLgY7ZbG.gif

 

TOPICS
Expressions , How to

Views

50

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

I think you have to transform the vector twice--once in the nested comp and then transform that resulting vector in the outer comp. It will probably look something like this:

L = comp("Whole Cube").layer(thisComp.name);
v = toCompVec([0,0,1]);
L.toCompVec(v)[2] > 0 ? value : 0

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

I am grateful for your response.  Could you possibly elaborate a little more?

I'm assuming you're implying I should apply this expression to the opacity in 'outer comp' -- however, I would need 6 parameters to alter opacity for each face of cube?  I tried to add a slider to see if this would register (so I could then carry it across each face), but it doesn't work.

Thank you.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

This is crazy, I just realized I was using your post from many many years ago as the foundation for this:  https://www.motionscript.com/design-guide/invisible-facing-away.html

 

🙂  Thank you for your contributions to the community.

I know it says I'm "new here" but I've been using AE for 10+ years, and my work acct won't let me use personal PC, so I have two accts. 

I couldnt do half of what I do without people sharing knowledge like you.  THANK YOU!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

So I kept trying to digest the logic you were sharing.

I tried referencing the outerComp 3D Cube Layer for each face's opacity in the nested comp.

 

And, I thought it was going to work, because my first test on Face_Front worked in the outer comp.

However, when I applied expression to the other faces, it had a weird response in outer comp (see GIF)

Worth noting, there is not two instances of toCompVec in this...  Still unsure what you mean about the 2nd instance.

AfterFX_jhHj2XFFbX.gif

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

LATEST

The expression was supposed to go inside the nested comp, just like your original attempt. You'd need to do that for each face of the cube.

Oops- I just noticed that's not how you did it originally, but with my test, I put the expression on the layer in the nested comp.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

Actually, I think I got it.  Using your reference from your website, I realized I was referencing Z coordinate [2] for each ... If I swapped the Left & Right faces to reference the X coordinate [0] it works now.

Capture22.PNG

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines