Spherical Gravity Question


I’m trying to get a spherical gravity system to work.

Right now I have an empty game object with this script:

var gravity : int;

function OnTriggerStay(hit : Collider) 


   if (hit.transform.tag == "Player") {

      var planet : GameObject = hit.gameObject;

      planet.rigidbody.velocity += (transform.position - planet.transform.position).normalized * gravity * Time.deltaTime; 



It’s at the center of a sphere. I am using the first person controller, tagged as player. The script doesn’t seem to have any effect on the player right now. I set the gravity on the first person controller to 0, and the gravity on the empty game object to varying amounts just to see if it worked, but it did not.

It either only falls or floats on a parallel plane.

Try this: http://forum.unity3d.com/threads/8873-Faux-Gravity-making-my-brain-spin…-Help!