FORUMS: list search recent posts

Absolute position of a Parented layer

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Wouter Dijkstra
Absolute position of a Parented layer
on May 6, 2019 at 4:27:20 pm

Hi Guys,

I'm looking for finding a way to get the real/absolute position of a layer that is parented to another layer.
Through other fora I found the expression of Dan:

L = thisComp.layer("child layer");
L.toWorld(L.anchorPoint);

But unfortunately it seems I don't get it. All the time I enter this expression the child-layer shifts away!

I tried many variations, but didn't find a solution. All I want is: 1. The absolute position of the child layer (so I can use it easier for further expressions in other comps) 2. This child-layer to stay exactly where it was.

I appreciate it guys!


Return to posts index

Walter Soyka
Re: Absolute position of a Parented layer
on May 6, 2019 at 4:49:18 pm

That expression should work, but you should use it in the referring layer, not apply it to the child layer.

Can you describe how you're setting your project up?

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Wouter Dijkstra
Re: Absolute position of a Parented layer
on May 6, 2019 at 5:08:34 pm

Thank you for your quick response!

I will explain my setup:

I parent Layer 1 to Layer 2 with the pickwhip.
Than I put in the code in Layer 1. I tried referring in the code to Layer 2. It didnt work. Maybe its a bug in my after Effects?

I also played around with the Anchorpoint but didnt work.

Is it in the pickwhip? I prefer to inherit position, scale, rotation. Its just a simple setup, but givea me difficulties. Thanks again for helping out


Return to posts index


Wouter Dijkstra
Re: Absolute position of a Parented layer
on May 6, 2019 at 5:10:12 pm

I did search for videos online. But they al handle more difficult set ups. Like 3D. Maybe I am missing something.


Return to posts index

Walter Soyka
Re: Absolute position of a Parented layer
on May 6, 2019 at 5:47:21 pm

What do you ultimately want to do with the absolute position?

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Wouter Dijkstra
Re: Absolute position of a Parented layer
on May 6, 2019 at 5:57:59 pm

I want to parent another layer in another composition to this layer.

But when I make an expression from this layer to the layer in the other composition it doesn't work (I think because it is using relative data and thinks "nothing is moving"). Because it does work when I parent to another test-layer which doesn't have any parenting.

Hopefully this makes it clearer. So let's say:

I have a bridge and I parented the bridge layer (bridge.layer) to a NULL rotating. Than from another composition I want to make the "whole" composition of the bridge move with this bridge.layer.

I want to have the absolute position of this bridge layer so the other composition has "real coordinates" to refer to.


Return to posts index


Wouter Dijkstra
Re: Absolute position of a Parented layer
on May 6, 2019 at 6:01:19 pm

It sort of similair to motion tracking that I want to do. So I want to follow the tip of the bridge layer (let's say a sort of NULL object is positioned there as an anchorpoint). So I need the position-data of this NULL object attached to the tip of the bridge.

Than in the other composition (containing) the bridge I want the camera/whole comp to follow this tracked NULL.


Return to posts index

Walter Soyka
Re: Absolute position of a Parented layer
on May 6, 2019 at 6:28:01 pm

[Wouter Dijkstra] "I have a bridge and I parented the bridge layer (bridge.layer) to a NULL rotating. Than from another composition I want to make the "whole" composition of the bridge move with this bridge.layer. "

You want to apply the expression to the position property of the layer that you want to move, and change it a little bit so that it refers to the comp and layer you want. Replace the names in quotes with your correct comp and layer names:

l = comp("The Main Comp").layer("Bridge");
l.toComp(l.anchorPoint);


I mocked up a quick example:

13322_absolutepositionreferenceacrosscomps.aep.zip

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Wouter Dijkstra
Re: Absolute position of a Parented layer
on May 6, 2019 at 10:33:08 pm

Hi Walter! Thanks a lot for making the mock-up. It helps a lot to see where you put the expressions.
It's clear what you did. But maybe I was understanding the "absolute position" wrong. Now all the time when I enter the expression the layer "shifts" position. I was hoping that you could enter an expression to Parented layers which would keep everything exactly the same, but would show the absolute values.

Also when I turn of the expression in your example you can see this shift. Was I hoping for a function that's not possible?





Return to posts index


Wouter Dijkstra
Re: Absolute position of a Parented layer
on May 6, 2019 at 10:38:35 pm



For example: When I attach a "NULL" object to the camera I want to use this NULL to track the camera-lens center. But the values are relative. How can I make sure I get the absolute values for this null, but keep it in the same position?


Return to posts index

Walter Soyka
Re: Absolute position of a Parented layer
on May 6, 2019 at 10:54:12 pm

[Wouter Dijkstra] "But maybe I was understanding the "absolute position" wrong. Now all the time when I enter the expression the layer "shifts" position. I was hoping that you could enter an expression to Parented layers which would keep everything exactly the same, but would show the absolute values. "

If you want to see the values without them affecting the placement of the object, add a Point Control effect to the layer and put the expression there. If you apply the expression to a live property like Position or Anchor Point, it will calculate and affect the placement of the layer.


[Wouter Dijkstra] "For example: When I attach a "NULL" object to the camera I want to use this NULL to track the camera-lens center. But the values are relative. How can I make sure I get the absolute values for this null, but keep it in the same position?"

This expression replaces a parent link. Don't make null a child of the camera. Use the expression instead to get the comp-space coordinates of its point of interest.

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Wouter Dijkstra
Re: Absolute position of a Parented layer
on May 6, 2019 at 11:00:32 pm

Point Control! That's what I need. I was maybe doing something that wasn't even possible. If I understand correctly: When there is a lot of layers parented to other layers, using the "absolute-expression" will always make the layer shift? Is that correct?

Thanks a lot for explaining so clearly and pushing me in the right direction!


Return to posts index


Walter Soyka
Re: Absolute position of a Parented layer
on May 6, 2019 at 11:22:33 pm

[Wouter Dijkstra] "When there is a lot of layers parented to other layers, using the "absolute-expression" will always make the layer shift? Is that correct?"

Yes, and here's what's happening. When you make one layer a child of another, it assumes the coordinate system of its parent. When Ae renders the layer, it works through all the transformations for the layer: its transformations relative to its parent, its parent's transformations relative to its grandparent, and so on.

When you ask for the absolute value in comp space, Ae will happily return it to you -- but remember, Ae is following its parenting logic for transforms, and that requires coordinates to be relative to the parent's layer space. Your expression causes the jump because you are smashing two separate frames of reference together.

Using the point control lets you see the value in a way that doesn't actually affect the transform chain.

Does that make sense?

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Wouter Dijkstra
Re: Absolute position of a Parented layer
on May 6, 2019 at 11:27:04 pm

Great to hear the actual explanation! ☺ Thanks for teaching me. I think I fully understand now. This whole situation kept me in the dark today, but I know how it works and what to do now. Thanks Walter!


Return to posts index

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