# Distance

## Distance Interest Management

The straight forward, brute force solution for Interest Management is to simply send all entities to all connections within range.  This is what **Network Proximity Checker** did:

```csharp
foreach spawned entity:
    foreach connection:
        if (Vector3.Distance(spawned, connection) < visRange):
            connection.Send(spawned);
```

The only downside is that it's relatively expensive to check every entity against every connection. So if you need loads of entities or connections, it would be smart to use a faster algorithm like [**Spatial Hashing**](https://mirror-networking.gitbook.io/docs/manual/interest-management/spatial-hashing).

### Setting Up

Add the **Distance Interest Management** component  to the same object as your **Network Manager**:

![](https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2FZVgewjg9dxzc039ryUbU%2Fimage.png?alt=media\&token=770ee10d-556e-477c-b631-3535b64f489b)

The **Vis Range** defines the radius around a player from which it receives world updates.

The **Rebuild Interval** is in seconds, and determines how often Mirror recalculates visibility of objects to clients.

### Custom Visible Range

The Vis Range setting above applies to all networked objects as the "default" range. You can override this value on objects that need a different range, e.g. exception cases for things that are very large or very small, relative to most other things in the scene. To do this, just add a **Distance Interest Management Custom Range** component to those objects and set the Vis Range values for those objects according to your needs.

![](https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2F5VKDz7jNfSbo6jxIx7Mo%2Fimage.png?alt=media\&token=95be9a49-0070-447d-a723-ce31bf900c82)
