I'm trying to make a planet affect other objects.
It kind of resembles artificial planetary gravity, but it is wierd, because the farther the object is, the more force it excerts. Perhaps there is something wrong with my formulation?
Vector3 direction = rbUnderInfluence [i].transform.position - transform.position;
intensity = gravitationalForce * (rb.mass * planetMass / distance * distance);
rb.AddForce (direction * intensity);
↧