I am working on a physics simulation, and am trying to “fill” objects with small spheres. I am using Collider.bounds.contains to make sure it fills the object. Instead of making the object out of the spheres, it follows a rectangular area around the object.

```
float x = obj_x;
float y = obj_y;
float z = obj_z;
Collider sape = GetComponent<Collider>();
x = sape.bounds.min.x;
y = sape.bounds.min.y;
z = sape.bounds.min.z;
bool ext = false;
while (ext == false)
{
Pos = new Vector3(x, y, z);
if (sape.bounds.Contains(Pos))
{
Instantiate(particle, Pos, Quaternion.identity);
}
if (z >= sape.bounds.max.z)
{
ext = true;
}else
if (y >= sape.bounds.max.y)
{
y = sape.bounds.min.y;
z += .1f;
}else
if (x >= sape.bounds.max.x)
{
x = sape.bounds.min.x;
y += .1f;
}
x += .1f;
}
```