Hey guys, I need your help!

I’m creating a 2D game about space. My player has to walk around the planets (sprites). I’ve already added a custom gravity to each planet.

Now I need some help with the rotation of the player. The feet of the player have to rotate to the center of the planet, so they are always touching the planet.

Does anyone know a simple way to do this? Or can you recommend me a tutorial?

Thanx in advance!

FIrst we need to calculate the angel that the object is with the center assuming the center is (0,0) , this works for 2d i don’t know about 3d; @Jorn Jilesen

```
//get the x and y of the object
dx = transform.position.x;
dy = transform.position.y;
//get the angle in radians
theta = Mathf.Atan2 (-dy, -dx);
//apply the rotation we need to convert the angle to degrees and add 90
transform.rotation = Quaternion.Euler (0, 0, theta * Mathf.Rad2Deg + 90);
```