# Position child on the edge of the parent circle while scaling unity3d

I have come across to some different situation. I have one circle sprite and i am rotating circle continuously while rotating i want to make circle smaller and larger.

I have one object on the edge of the circle i have made that object as child of the circle.

Now my problem is how to make this child object to stay at the edge while i scale circle sprite . I s this possible ?

Thanks.

You can use transform.localPosition to determine the position of the child object relative to its parent.

The normalized version of this vector, .normalized, can be multiplied with the parent's scale to get the desired local position.

You might want to set the scale of the parent to 1 and position the child accordingly if you don't already do so. Otherwise, when multiplying with the scale it will not be on the edge of the circle. Alternatively, you can use a multiplier.

If you have a circle sprite, that you want to rotate around a point other than its center, there is a much more effective way than this.

Just go to the circle sprite in assets, and change the pivot of the sprite to the edge you want it to be.

And that's it, you should get a rotation around that pivot, and when you scale, it'll stay the same. And don't forget to add the collider if you want it to collide, after you finish setting the pivot.

Here are my steps for child objects. Maybe it's hard to solve this only in parent object?

1. Before scaling parent, remember my parent
2. When parent is scaled, leave/disconnect from my parent
3. When parent is finished scaling, go back and reconnect to original parent.