# Areas of Interest

### LiveQuery

The way you get information about the world is through **LiveQueries**. We set criteria for what part of the world we are interested in at each given moment. That way, the Replicator won’t send information about everything that is going on in the Game World everywhere, at all times.

Instead, we will just get information about what’s within a certain area, kind of like moving a torch to look around in a dark cave.

{% hint style="info" %}
More complex area of interest types are coming in future versions of **coherence**.
{% endhint %}

### Adding a LiveQuery to the scene

<figure><img src="https://content.gitbook.com/content/fo6vUwbCyyb7fmwjPG0A/blobs/DYMpjlOQph1Ctix3VXgg/add-live-query.png" alt=""><figcaption></figcaption></figure>

A LiveQuery is a cube that defines the area of interest in a particular part of the World. It is defined by its **position** and its **extent** (half the side of the cube). There can be multiple LiveQueries in a single scene.

![](https://content.gitbook.com/content/fo6vUwbCyyb7fmwjPG0A/blobs/FrCjMGbDqLEu0uTnaa7J/image.png)

### Moving a LiveQuery

A classic approach is to put a LiveQuery on the camera and set the extent to correspond to the far clipping plane or visibility distance.

Moving the GameObject containing the LiveQuery will also notify the Replication Server that the query for that particular Game Client has moved.

### Adding a TagQuery

In addition to the LiveQuery, **coherence** also supports filtering objects by tag. This is useful when you have some special objects that should always be visible regardless of World position.

To create a TagQuery, right click a GameObject in the scene and select *coherence > TagQuery* from the context menu.

![](https://content.gitbook.com/content/fo6vUwbCyyb7fmwjPG0A/blobs/YMVLpTWm9tFBooHuTPkx/tagquery2.png)

All networked GameObjects with matching tags will now be visible to the Client. The **coherence** tag can be any string and can be configured separately from the `Unity tag` in the *Advanced Settings* section of the `CoherenceSync` component.

![](https://content.gitbook.com/content/fo6vUwbCyyb7fmwjPG0A/blobs/h35UiCJbJKjegWLi2eve/csync-tag-query.png)

Tags and TagQueries can be updated at any time while the application is running, either from the Unity inspector or setting `CoherenceSync.coherenceTag` and `CoherenceTagQuery.coherenceTag` with code.

Currently, only a single tag per GameObject and TagQuery is supported. To include objects with different tags, you can create multiple TagQuery objects for each tag.

{% hint style="info" %}
In the future, we plan to integrate TagQueries with LiveQueries allowing combined query restrictions, e.g., only show objects with tag "red" within an extent of 50.
{% endhint %}

{% hint style="info" %}
Queries can also be used for cheat prevention, see [Server authoritative setup](https://docs.coherence.io/1.2.4/manual/authority/server-authoritative-setup) for more information.
{% endhint %}
