Move object around point depending on another object's position

Hi, so imagine an object (e.g. red square) and another object (e.g. star). I want the red square to move around a point (circular motion) depending on the position of the star.


If the star is directly to the right of the red square, the red square should be "aiming" towards the right. When the star moves around the scene to another position, the red square should "aim" towards wherever the star is.
I've attached a couple screenshots to clarify, and I've also included a link to a video (reference for the circular movement) because I'm not sure what I just wrote is even coherent in any sense. Still, hope someone can provide some advice on how this works. Thanks!
[Youtube video for the circular movement (I need this but it should move depending on player position)][1]

198724-demo.png

Fortunately, this is fairly straightforward Vector math.

First, you have your center point. Let’s just call it Vector3 center

You have the square. Let’s call it Transform square

You have the distance of the square from the center. It will be float radius

And you have the star. We’ll call it Transform star

(if it makes more sense for the center point to also be a Transform, that’s an easy adjustment to make)

First, you’ll need the direction from the center to the star, normalized because the radius will control distance later.

Vector3 centerToStar = (star.position - center).normalized;

Then, you use the radius to position the square

square.position = centerToStar * radius + center;

… Yep. That’s all. Four variables and two lines of code to align with it.