Discussion:
Parenting and 3D Position...
(too old to reply)
C***@adobeforums.com
2006-11-29 12:19:03 UTC
Permalink
Hi!

It's my first post here. I'm new to AE expressions, but not to programming (I develop interactive media in Director).

I have been experimenting with expressions and have successfully written many useful scripts, including one to join 2 layers in space with a line - all works great, allowing complex tangled network-style animations, and saving the AE animators here huge amounts of keyframing.

But... the AE guys here often use Null objects to control and manage their animations, and we discovered that as soon as either of the layers is made a child of anything else, it broke. So I wrote more code to calculate the offset from the Parent - this works fine for translation (x,y,z positions), but not for rotations. Unlike many 3D applications, there is no 'worldPosition' property for objects (layers) ie. it's position and rotation are only relative to the parent. Do I really need to melt my brain doing 3D matrix calculations to compute the child layer's actual position in the 3D world? And if so, any tips for doing so?

Sorry for rambling - hope it's clear. Any help would be most welcome - thanks.

Regards, Paul.
P***@adobeforums.com
2006-11-29 13:27:12 UTC
Permalink
To find the actual position you can use this expression:

the3Dchild = thisComp.layer("White Solid 1");
the3Dchild.toWorld(the3Dchild.anchorPoint);

It converts from layer space coordinates (which is why you use anchorPoint) to 3D world space. You could also apply an Expression Control > Point Control to the 3D child and use that instead:

the3Dchild = thisComp.layer("White Solid 1");
the3Dchild.toWorld(the3Dchild.effect("Point Control")("Point"));

The last question on here was very similar, check out "Calculating the actual 2D position in a canvas of a 3D layer" to see how to convert from 3D space to 2D comp space.

Paul T
C***@adobeforums.com
2006-11-29 16:11:18 UTC
Permalink
Hi there.

Thank you very much for your help! I did spend some time looking around to see if someone else had come across this issue, and indeed checked the thread you refer to, but it never clicked.

Coming from a different programming environment, I have problems in getting my head around expressions and how they work (sliders, no global variables, etc.). Could you recommend any good guides for me? So far I have checked Dan Ebberts' websites and they have been a great help.

Thanks again.

Regards, Paul.

Loading...