Table of Contents

Coherence.Interpolation

Classes

BindingInterpolator

BindingInterpolator is used to smoothly interpolate between samples received over the network. The following types are supported for interpolation: float, bool, int, long, Vector2, Vector3, Quaternion, Color, string and EntityReferences. Additional Smoothing (using SmoothDamp) is supported for types: float, Vector2, Vector3 and Quaternion.

InterpolationSettings
InterpolationUtils
Interpolator

Base class used for blending between sample points. The base implementation simply provides latest data sampling so that values "snap" to the sample that is latest. By sub-classing and overriding these methods, more refined interpolation can be achieved (see LinearInterpolator and SplineInterpolator). Interpolation can be implemented either using 2 samples or 4 samples. Methods are specified for all supported types, taking sample values as parameters together with the time t that is expressed as a fraction between value1 and value2. Unless the 4 sample methods are overriden, they will simply call the corresponding 2 sample methods that will suffice for most types of interpolation.

LinearInterpolator

The LinearInterpolator performs a linear blend between two adjacent samples. The LinearInterpolator is defined for types int, long, float, Vector2, Vector3, Color and Quaternion (using UnityEngine.Quaternion.Slerp(UnityEngine.Quaternion,UnityEngine.Quaternion,System.Single)).

SampleBuffer

SampleBuffer stores sample points in a circular buffer. The buffer is backed by an array that currently cannot be resized. The buffer is guaranteed to be ever increasing, i.e. this[n].Time > this[n-1].

Smoothing

Provides smoothing using SmoothDamp for types: float, Vector2, Vector3 and Quaternion. Smoothing unlike ordinary interpolation, cannot be rewinded, so keep smoothing at a minimum for accurate hitbox rewind. Quaternion smoothing uses SmoothDampAngle for its three euler angles, which may cause a performance hit for large number of objects.

SplineInterpolator

The SplineInterpolator blends sample values smoothly using a Catmull-Rom curve. The SplineInterpolator is defined for types float, Vector2 and Vector3.

Structs

InterpolationResult
LatencySettings
Sample
SmoothingSettings