Hello All !

I am making a little prototype with in 2D which involves simulating planetary gravity to some degree. I have implemented a function to calculate the force applied to the object based on the mass of both object and the distance between them which seems to work fine and gravity gets applied quite realistically.

However the problem that i encountered was when I tried to visualize the area of influence for the gravity for the bodies. As you can see from the screenshot there are some gizmo wire spheres that i attempted to use.

On start function of the orbital object I run this function to calculate the radius that then can used to draw the sphere. The way it works is that i run a while loop adding abit of distance to x and checking the strength of gravity at that position until its < 0.1f. while it seems to work if I change the starting location of the moons, the radius get bigger the further we get from the centre of the screen. I am perplexed as to why it happens. Opposite is also true the closer to the centre the smaller it gets.

this is the function to calculate radius.

```
private float CalculateRadius()
{
Vector3 gravityStrength = GravityStrengthAtPosition(1, furthestPointOfGravity);
while (gravityStrength.x > 0f)
{
furthestPointOfGravity += new Vector2(0.01f, 0);
gravityStrength = GravityStrengthAtPosition(1, furthestPointOfGravity);
}
float radius = Mathf.Abs(furthestPointOfGravity.x);
return radius;
}
```

this is to calculate the strength of gravity:

```
public Vector3 GravityStrengthAtPosition(int objectMass, Vector3 objectPosition)
{
Vector3 direction = objectPosition - this.transform.position;
float distance = direction.sqrMagnitude;
float gravityStrength = (G * objectMass * mass) / distance;
if(gravityStrength < 0.1f)
{
return Vector3.zero;
}
Vector3 force = direction.normalized * gravityStrength;
Debug.Log(force);
return force;
}
```

I would love any insight and or help with this strange issue.

Thank you very much !