So, basically, you want to look top down on a guy, who is walking on a small planet, and you want the distance from the camera to the person the same.
The term here is up Vector.
There are two up vectors you have to worry about, one is the up vector of the planet, the second is the up vector, which is actually the forward vector of the person.
Up vector from the planet is (person.position - planet.position).normalized. This is the direction which is up for the person to work at all.
Next, we need to fit the person vertically, to do this we will have to reach into a mathematical bag of tricks. First we need the distance from the planet’s core to the person (person.position - planet.position).magnitude. Then we get the normalized direction of the current velocity, normalized. ((person.position + rigidbody.velocity.normalized) - planet.position).normalized and multiply that by the distance we got before. What this does is gives us the position on the planet where the person is actually facing. Now, we simply look at that spot, and use the up direction we had before. (person.LookAt(lookAtVector * personDistance, upVector)).
Next onto the camera. Lets say the camera is always 10 units “above” the person. We have the position of the person, the distance he is from the center of the planet and the upvector. All we need to do is add 10 to the distance, and use an up vector from the person’s forward position. (cam.position=planet.position + upVector * (personDistance + 10)). And the look at: (cam.LookAt(planet.position, person.forward))
var planet=GameObject.Find("Planet").transform;
var cam=Camera.main.trasnform;
var person=transform;
var upVector=(person.position - planet.position).normalized;
var personDistance=(person.position - planet.position).magnitude;
var lookAtVector=((person.position + rigidbody.velocity.normalized) - planet.position).normalized;
person.LookAt(lookAtVector * personDistance, upVector);
cam.position=planet.position + upVector * (personDistance + 10);
cam.LookAt(planet.position, person.forward));
Do test this stuff… Sadly, its understanding with no testing. lol