Skip to main content
Participant
April 9, 2024
Question

Expression to return the coordinates of the bounding box of a precomp

  • April 9, 2024
  • 2 replies
  • 223 views

Hi there, I'm wondering if anyone has an expression that returns the realtime coordinates of a null that is parented to a rotating precomp.

 

The issue I'm having is that because the null is parented to the precomp, the position and anchor point of the null don't technically change, even though it is rotating based on the rotation of the precomp.

 

Let me know if you need more info.

 

Thanks!

Matt

This topic has been closed for replies.

2 replies

rossigoatAuthor
Participant
April 9, 2024

This hopefully describes the problem. I have a layer (could be a shape layer or a precomp) that is rotating from the anchor point at the bottom. I have a null (purple box at the top left of the shape layer) parented to this rotating shape layer. When I try to get the coordinates of the null object, it only gives the coordinates of the null relative to the anchor point of the shape layer, the layer it's parented to.

Community Expert
April 9, 2024

The actual Position of a child layer ("Null 1" in this example) is retrieved by using the toWorld(AnchorPoint) function like this:

L = thisComp.layer("Null 1");
pos = L.toComp(anchorPoint);

If you need more than that, we need screenshots with the modified properties of the problem layers. Select the layers, press the 'u' key twice, then take a screenshot of the entire UI and share it.

rossigoatAuthor
Participant
April 9, 2024

It might also be helpful to find an expression that returns the coordinates of the edges of the precomp's bounding box 🙂