[Unity]Allows another object to revolve around the specified object
Hello
Sometimes we want to create an object that orbits around a certain object, like the moon.
So, I will show you how to create an object that orbits around any object.
We have a white cube and a red cube, and we want the red cube to circle around the white cube.
Create a new script (we’ll call it AroundTest) for the red cube and write the following

Set the white cube to GameObject cube.

In the Update function, write code to orbit around the coordinates of the white cube.
To be honest, I am not good at sine, cosine, etc. (waterfall sweat)
If you run the above


It would be easier to understand if I made a gif image, but my sleepiness is getting to the limit, so sorry for the still image.
It is going around and around clockwise as shown below.




![[Unity] Removing grass grown on Terrain from scripts](https://kuroko-labo.com/wp/wp-content/uploads/2025/05/grass2.png)
![[Unity] Executing a method at an arbitrary time with Photon’s PUN2](https://kuroko-labo.com/wp/wp-content/themes/kuroko3/images/noimage.png)
![[Unity]I made a field with Gaia Pro 2023.](https://kuroko-labo.com/wp/wp-content/uploads/2025/01/image06.png)
![[Unity]I bought an OLD TV Filter.](https://kuroko-labo.com/wp/wp-content/uploads/2019/11/image05.png)
![[Unity]Try to create a circle gauge that advances when the mouse is clicked.](https://kuroko-labo.com/wp/wp-content/uploads/2019/07/circle.fw_.png)
![[Unity]Use localPosition to create a conveyor belt-like](https://kuroko-labo.com/wp/wp-content/uploads/2019/06/image01-1.png)