public void Attract(Transform body) { world = worldGO.GetComponent("GenerateWorld") as GenerateWorld; Vector3 gravityUp = (body.position - CalculateCenterOfWorld(world.GetSizeWorld())).normalized; Vector3 localUp = body.up; body.GetComponent <Rigidbody>().AddForce(-gravityUp * gravity); body.rotation = Quaternion.FromToRotation(localUp, gravityUp) * body.rotation; }