Nulls, animating POI and cameras...
by Paul Maguire
on
May 16, 2008 at 11:05:17 am
Hi again.
I find it really tricky to get my feeble brain around this.
I have a camera parented to a Null. The camera is set -500 in the z (this null is used to easily animate and control the camera). The null is set at [0,0,0], and rotates around another 3D layer also set at [0,0,0], so we 'fly around' the object. Fine. Problem occurs when I try to animate the camera's POI to another object. I want to look at something else as we fly around - in fact I want to be able to animate the camera's POI as the camera flys around.
Simply setting the camera's POI with an expression like:
thisComp.layer("POInull").position;
...fails - and I know it's to do with Layer Space transforms (because camera is child of Null), so I try this is in the POI expression box for the camera:
toWorld(thisComp.layer("POInull").anchorPoint);
...and this fails too.
I just want to attach the camera's POI to a Null, but also have the camera be a child of another Null. I'm sorry for being so lame but it's just doing my head in. Any help most welcome. Also - any good pointers to info on this type of thing? I wish I was more confident about layer space transforms in AE expressions - always seems to come up in the studio.
Re: Nulls, animating POI and cameras... by Paul Maguire on May 16, 2008 at 2:49:35 pm
It works perfectly. Thanks Dan.
So to understand this so I idon't keep having to come back to you on almost the same question...
L = thisComp.layer("POI");
(L is a local reference to layer "POI")
parent.fromWorld(L.toWorld(L.anchorPoint))
So, I simply don't understand this, even with the manuals here!
L.toWorld(L.anchorPoint)
this takes the anchor point of the POI layer and returns a 3D coordinate of it's absolute position in space - but the anchorPoint doesn't ever change: always [0,0,0] ??? I don't even get why it's L.toWorld(L.anchorpoint) - why not simply toWorld(L.anchorPoint)???
I'm looking at the rest of the line - sigh - I think I'll stop. Sorry. I'm frustrated. I need to understand how this works. Is it possible for you to quickly break this second line into pseudocode? I need a revelatory moment. If not, no worries - I've got to get to the bottom of it.
Re: Nulls, animating POI and cameras... by Dan Ebberts on May 16, 2008 at 3:25:09 pm
L.toWorld(L.anchorPoint) is only necessary if your POI layer has a parent. If it doesn't, you could just use L.position to get the world position of the layer.
In any case you use L.toWorld() instead of just toWorld() because you want to translate from the POI layer's layer space. If you use toWorld() without specifying the layer, the expression will assume that you want to translate the POI layer's anchor point from the camera's layer space, which doesn't make any sense.
When a layer becomes the child of another layer, it assumes the parent's layer space. So in this case, once we get the POI layer's positon into world space, we need to traslate it from world space to the camera's parent's layer space.