Activity › Forums › Adobe After Effects › Absolute position of a Parented layer
-
Absolute position of a Parented layer
Posted by Wouter Dijkstra on May 6, 2019 at 4:27 pmHi 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!
Wouter Dijkstra replied 7 years, 2 months ago 2 Members · 13 Replies -
13 Replies
-
Walter Soyka
May 6, 2019 at 4:49 pmThat 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 | RenderBreak [blog] | Profile [LinkedIn] -
Wouter Dijkstra
May 6, 2019 at 5:08 pmThank 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
-
Wouter Dijkstra
May 6, 2019 at 5:10 pmI did search for videos online. But they al handle more difficult set ups. Like 3D. Maybe I am missing something.
-
Walter Soyka
May 6, 2019 at 5:47 pmWhat 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 | RenderBreak [blog] | Profile [LinkedIn] -
Wouter Dijkstra
May 6, 2019 at 5:57 pmI 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.
-
Wouter Dijkstra
May 6, 2019 at 6:01 pmIt 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.
-
Walter Soyka
May 6, 2019 at 6:28 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 | RenderBreak [blog] | Profile [LinkedIn] -
Wouter Dijkstra
May 6, 2019 at 10:33 pmHi 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?


-
Wouter Dijkstra
May 6, 2019 at 10:38 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?
-
Walter Soyka
May 6, 2019 at 10:54 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 | RenderBreak [blog] | Profile [LinkedIn]
Reply to this Discussion! Login or Sign Up