Hi, as you can read in the title i want to know how to make a planet gravity that affect the asteroids with rigidbody, and if it hit something big the asteroid will get out of the planete orbit.
that is what i did:
var Forward_Speed : float = 0.2;
var Direction : Transform;
var Planet : Transform;
var Speed : float = 0.8;
function Start() {
Gravity = 0.00;
}
function LateUpdate ()
{
rigidbody.AddForce(Direction.TransformDirection(Vector3.forward * Forward_Speed * Time.deltaTime));
transform.RotateAround(Planet.transform.position, Vector3.up,Speed * Time.deltaTime);
}