# Interpolation

### Overview

Depending on the settings in our project, data may not always arrive at a smooth 60 frames per second through the network. This is completely okay, but in order to make state changes (e.g. movement, rotation) appear smooth on the client, we use interpolation.

**Interpolation** is a type of estimation, a method of constructing new data points within the range of a discrete set of known data points.&#x20;

The way interpolation works in **coherence** is that we wait for three data points and then start smoothing the subsequent values according to the interpolation parameters defined in the interpolation settings provided.

### Binding Interpolation Settings

On the Select and Optimize windows, every binding which has an interpolable type will shows a interpolation settings object picker next to it.

![](/files/xaCO2PORrmZWxPA6isZs)

![](/files/ZVsziIZC1Wi24tT4hZ8E)

Currently supported interpolable types are:

* int
* float
* Vector2
* Vector3
* Quaternion

coherence provides built-in interpolation settings for position and rotation, but you are free to create your own and use them instead.

![](/files/XpAi9JZcRZ1rvckrKyGZ)

{% hint style="info" %}
You can also create an interpolation settings asset: `Assets > Create > coherence > Interpolation Settings`
{% endhint %}

There, you have a few settings you can tweak:

* Curve Type: the type of interpolation used
* Elasticity: seconds to remain behind the current interpolation point, applied to `smoothdamp` function or slerp
* Max Distance: maximum distance between data points before the component "teleports" to the next value without smoothing.
* Latency
  * Manual: seconds to stay behind the sample data.
  * Auto: `targetInterpolation = autoLatencyFactor * packetDeltaTime`&#x20;
    * &#x20;`-1` disables auto latency.
* Overshooting
  * Max: how far into dead reckoning we can venture when the time fraction exceeds 100%.
  * Retraction: how fast to pull back to 100% if we overshoot the allowed dead reckoning maximum in seconds

Interpolation works both in baked and reflection modes. You can change these settings at runtime via the Select window (editor) or accessing the binding and changing the interpolation settings yourself:

```csharp
if (coherenceSync.TryGetBinding(typeof(Transform), "position", out IBinding binding)
{
    // change your interpolation settings at runtime
    binding.InterpolationSettings = ...
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.coherence.io/0.7.4/optimization/interpolation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
