// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.R)) { discover.Reset(); } //Attract foreach (Planet p in system) { float distance = ((Vector2)discover.transform.position - (Vector2)p.transform.position).magnitude; if (distance > p.minDistance && distance < p.maxDistance) { discover.ApplyForce(p.Attract(discover)); } } discover.Move(); }