Skip to main content
Known Participant
March 5, 2025
Question

Push/Pull Objects Around Null

  • March 5, 2025
  • 2 replies
  • 582 views

Hello all,

 

I'm trying to create a target reticule effect where four separate objects converge on a central point. To do this, I've parented them to a null object and set up a script to work off the null's scale property.

 

 

The script I use is:

 

pSc = parent.scale;
x = value[1]*100/pSc[1];
y = value[0]*100/pSc[0];
[x,y];

 

I also use a separate script to maintain the child layers' scale, but that doesn't seem relevant to my struggle.

 

The problem occures when I change the parent scale and the entire array moves in a uniform direction. Instead of converging on the center, I wind up displacing the array.

 

 

As far as I can tell, the object in the upper left is moving as I wish. It's the other three that need some kind of inversion, but I'm not sure how to modify the script to accomplish this.

 

Any suggestions?

2 replies

Community Expert
March 5, 2025

What have you done about the anchor points? Do you want to maintain the layers' size while changing the position? If you need to keep size but have the scale of the parent affect the position, then you need calculations on both scale and position/anchor point. The other option is to avoid parenting and use the scale value of a null to offset the anchor point of the objects you want to move or set up a slider to control position offset from the center.

 

It would help us help you if we saw a screenshot of your timeline showing the modified properties of the problem layers. Just press the 'u' key twice and share a screenshot.

Known Participant
March 5, 2025

I do want to keep each layer a consistent size while changing the position. I experimented with the anchor point location and found that setting all the points to be at the composition's center was the least-bad outcome.

 

I searched online a great deal before asking here and what I currently have is the best option I found. I would like to do this simply and if setting up a slider is a better option then I'd rather use that. Problem is I'm not very strong at scripting so I'm not sure how to start.

 

Here is a screenshot of my expressions and the layout of one object.

Known Participant
March 5, 2025

Ah, success! Your suggestion about linking the anchor point ot the scale worked for one of the objects. Then I tried using the mirror effect twice to create duplicates that now move the way I wanted.

 

Thanks for the idea!

Dan Ebberts
Community Expert
Community Expert
March 5, 2025

Have you tried positioning the parent at the center of the 4 child objects?

Known Participant
March 5, 2025

Yes, it's located dead-center. I've also set the anchor points of all four objects to match.