trying to use transform.RotateAround, but on local axis

I’m trying to use the RotateAround, to spin an object around other one. Until HERE, there’s no problem.

The spheres are spinning around the box, but the box isn’t placed in fixed place.

When the place where it’s fixed, rotate, the box follows, but the spheres loses the direction where they should it be spinning.

I thought in use a localPostition to set the axis where the object will be spinning, but i have no idea about how will i do this.

Any kind of help will be welcomed.

Ty all

public GameObject mySun;
public int speed ;

void Update ()
    {
            transform.RotateAround(mySun.transform.position, Vector3.up, speed * Time.deltaTime);
    }

use transform.localposition

you mean instead of transform. position ?

i did try it, but the problem keeps the same.

This’s a image of what is going on.

those fences, should be spinning around the bush.

use
transform.localRotation = Quaternion.identity;

u may use

i’ve found a solution, not sure if it’s the right one.

i’ve created an new object, right on the position where the main one is placed and used the transform.Rotate on it.

then i’ve placed the ones that should be spinning around as children.

and it works \o/

but i’ll check your links.

Ty hariavm =D

u r welcomeee