Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Push/Pull Objects Around Null

Explorer ,
Mar 05, 2025 Mar 05, 2025

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 initial setupThe initial setupexpand image

 

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.

 

The array after reducing the scale to -34.The array after reducing the scale to -34.expand image

 

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?

TOPICS
Error or problem , Expressions , How to , Performance , Scripting
160
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 05, 2025 Mar 05, 2025

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 05, 2025 Mar 05, 2025

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 05, 2025 Mar 05, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 05, 2025 Mar 05, 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.Screenshot 2025-03-05 at 3.00.44 PM.pngexpand image

Scripts for both position and scale.Scripts for both position and scale.expand image

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 05, 2025 Mar 05, 2025
LATEST

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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines