Thank you for your reply, however, that is not what im doing at all and i have no idea where you got that as that would completely defeat the purpose. It uses physics and their own gravities to move, somewhat like real life
void
FixedUpdate()
{
if (Application.isPlaying)
{
foreach (CelestialBody attractor in CelestialBodies)
{
if (attractor != this)
Attract(attractor);
}
foreach (GravityObject rb in GravityObject.gravityObjects)
{
AttractOBJ(rb.rb);
}
}
}
void Attract(CelestialBody objToAttract)
{
Rigidbody rbToAttract = objToAttract.rb;
Vector3 direction = rb.position - rbToAttract.position;
float distance = direction.sqrMagnitude;
if (distance == 0f)
return;
float forceMagnitude = G * (rb.mass * rbToAttract.mass) / distance; // Mathf.Pow(distance, 2);
Vector3 force = direction.normalized * forceMagnitude;
rbToAttract.AddForce(force);
}
void AttractOBJ(Rigidbody objToAttract)
{
Rigidbody rbToAttract = objToAttract.GetComponent<Rigidbody>();
float distance = Vector3.Distance(transform.position, objToAttract.transform.position);
if (distance > raiuds * 5f)
return;
Vector3 targetDir = (objToAttract.transform.position - transform.position).normalized;
Vector3 bodyUp = objToAttract.transform.up;
if (rbToAttract.transform.tag == "Player" || rbToAttract.transform.tag == "Animal")
{
objToAttract.transform.rotation = Quaternion.FromToRotation(bodyUp, targetDir) * objToAttract.transform.rotation;
};
rbToAttract.AddForce(targetDir * -surfaceGravity);
}
This is how i handle the movement of planets and stuff, and because they attract each other i dont have to use transform.Translate(), transform.Rotate() in the first place like you assumed i was, instead i give them an inital velocity and they orbit each other naturally
Again, this is ALL THE CODE being used to move the planets
void Attract(CelestialBody objToAttract)
{
Rigidbody rbToAttract = objToAttract.rb;
Vector3 direction = rb.position - rbToAttract.position;
float distance = direction.sqrMagnitude;
if (distance == 0f)
return;
float forceMagnitude = G * (rb.mass * rbToAttract.mass) / distance; // Mathf.Pow(distance, 2);
Vector3 force = direction.normalized * forceMagnitude;
rbToAttract.AddForce(force);
}
Which does not use transform.Translate() OR transform.Rotate()
Like i stated previously, i believe the problem arises with all the extra objects being pulled by the surface gravity (the ‘AttractOBJ’ method)
Which looks like this
void AttractOBJ(Rigidbody objToAttract)
{
Rigidbody rbToAttract = objToAttract.GetComponent<Rigidbody>();
float distance = Vector3.Distance(transform.position, objToAttract.transform.position);
if (distance > raiuds * 5f)
return;
Vector3 targetDir = (objToAttract.transform.position - transform.position).normalized;
Vector3 bodyUp = objToAttract.transform.up;
if (rbToAttract.transform.tag == "Player" || rbToAttract.transform.tag == "Animal")
{
objToAttract.transform.rotation = Quaternion.FromToRotation(bodyUp, targetDir) * objToAttract.transform.rotation;
}
rbToAttract.AddForce(targetDir * -surfaceGravity);
}
Like i said before i think that while these objects are on the ground gravity is still being applied to them which causes them to exert some of that force back onto the planet theyre on. I believe this because i have one much less complicated planet that is water (no solid floor) with a landing pad on the side with a few crates and it would always deviate in that direction. I drew a diagram to help with this concept

I tried making it so the velocity would be saved and reloaded after so the gravity didnt have any effect but that didnt work
Vector3 oldVelocity = rb.velocity;
rbToAttract.AddForce(targetDir * -surfaceGravity);
rb.velocity = oldVelocity;
I realize i wasnt very clear in my first place in what exactly the problem was but i hope this makes it clearer.
Any further help is appreciated