How to make a good spherical gravity

Hello! I was searching a lot and I can’t find a nice way to do this. I want to make like little worlds, where I can walk arround.

I've tried with this script:
    // Use this for initialization
    	Rigidbody rb;
    	public GameObject sphere;
    	public Vector3 planetCenter;
    	public float acceleration;

	void Start () {
		rb= this.GetComponent<Rigidbody>();
	}
	
	// Update is called once per frame
	void Update () {
		rb.AddForce((planetCenter - transform.position).normalized * acceleration);
		
		Vector3 groundNormal = transform.position - sphere.transform.position;
		
		Vector3 forwardsVector = -Vector3.Cross(groundNormal, transform.right);
		
		transform.rotation = Quaternion.LookRotation(forwardsVector, groundNormal);
	}

I put this in the fps character of standard assets, but it doesn’t work good, the camera goes crazy and if I walk I start to get a lot of speed and start to orbit around the planet.

Sorry if I’m asking something too complex, should I forget it and do something easier? I’m programmer, but I don’t know a lot about physics

Sorry for my bad english.
Thanks!

Are you still using normal gravity as well as calculating your own for the individual planets? I imagine that could create some weird behaviour.

As for actually calculating the gravity, robertbu has a good answer here.

Ahh, the good ol’ Mario Galaxy question… Consider the size of the earth and the fact that we don’t naturally consider ourselves as moving spherically as we walk or drive from place to place. Our destinations are effectively seen as across flat ground from us. If we run and jump, we can’t really get moving quickly enough to produce a meaningful orbital trajectory.

With that in mind, now scale down only the size of the planetoid. The gravitational force can remain the same, the physical attributes of the person can remain the same, but the attracting body is now tiny.

If you run and jump, now you’re traveling a significant distance relative to the surface of the ground below due to its tiny radius. If you move even a little bit quickly, then you’ll easily find yourself able to reach an orbital velocity.

What you’re looking to do defies many typical conventions of ordinary physics. Therefore, in order to implement an adequate control scheme, you’ll need to defy those physics yourself.

For example, Unity’s Character Controller is generally limited to standing upright in world space (if a change was made to that in Unity 5, I simply haven’t heard about it yet). Therefore, you’ll need to adapt it or make your own able to freely rotate.

Second, the camera controls likely can’t be handled through common convention because common convention assumes that the Y-axis is your global up/down. You’ll likely need to research and experiment with Quaternion rotations to make it do what you want.

Then, if you want your character to stick to the ground unnaturally while moving quickly enough to leave the ground, you’ll need to forcibly redirect the character’s velocity to maintain alignment with the ground.

Hope this give you some good food for thought!