public void MoveDistantBodies(Vector2 position, float near, float far)
{
for (int i = 0; i < body_list.Count; i++)
{
Body body = body_list[i];
if (body.is_static)
continue;
float distance = (body.position - position).Length();
if (distance > far)
{
Vector2 point;
point.X = ((float)rand.NextDouble() - 0.5f);
point.Y = ((float)rand.NextDouble() - 0.5f);
point.Normalize();
point *= near + (far - near) * ((float)rand.NextDouble());
point += position;
while (IsPointInsideAnyBody(point))
{
point.X = ((float)rand.NextDouble() - 0.5f);
point.Y = ((float)rand.NextDouble() - 0.5f);
point.Normalize();
point *= near + (far - near) * ((float)rand.NextDouble());
point += position;
}
body_list[i].position = point;
body_list[i].Update(0);
}
}
}