> For the complete documentation index, see [llms.txt](https://kinematicsoup.gitbook.io/reactor/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kinematicsoup.gitbook.io/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksconverginginputpredictor.md).

# Class ksConvergingInputPredictor

Namespace: [KS.Reactor.Client](/reactor/api-reference/ks.reactor.client.md)\
Assembly: KSUnity.dll

Predicts movement and properties based on user input using a player controller. Accelerations are slower than the server so the client and server will converge. Controller updates are used to predict a future server position, and the client render position interpolates towards the predicted server position. New server frames will make corrections to the future predicted server position, and may trigger a rewind and replay of controller inputs to get a new predicted server position.

```csharp
public class ksConvergingInputPredictor : ksIPredictor
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) â† [ksConvergingInputPredictor](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksconverginginputpredictor.md)

#### Implements

[ksIPredictor](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksipredictor.md)

#### Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\)), [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\)), [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode), [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype), [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone), [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals), [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Properties

### Config <a href="#ks_reactor_client_ksconverginginputpredictor_config" id="ks_reactor_client_ksconverginginputpredictor_config"></a>

Configurable data for customizing the the predictor. Returns null if the predictor is using the [Default](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksconverginginputpredictor/ks.reactor.client.ksconverginginputpredictor.configdata.md#KS_Reactor_Client_ksConvergingInputPredictor_ConfigData_Default). Assign this if you want to override the defaults.

```csharp
public ksConvergingInputPredictor.ConfigData Config { get; set; }
```

#### Property Value

[ksConvergingInputPredictor](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksconverginginputpredictor.md).[ConfigData](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksconverginginputpredictor/ks.reactor.client.ksconverginginputpredictor.configdata.md)

### QueryFilter <a href="#ks_reactor_client_ksconverginginputpredictor_queryfilter" id="ks_reactor_client_ksconverginginputpredictor_queryfilter"></a>

Query filter to use when testing for collisions using the default [MoveChecker](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksconverginginputpredictor/ks.reactor.client.ksconverginginputpredictor.movechecker.md) with a non-dynamic rigid body.

```csharp
public ksIQueryFilter QueryFilter { get; set; }
```

#### Property Value

[ksIQueryFilter](/reactor/api-reference/ks.reactor/ks.reactor.ksiqueryfilter.md)

### QueryFlags <a href="#ks_reactor_client_ksconverginginputpredictor_queryflags" id="ks_reactor_client_ksconverginginputpredictor_queryflags"></a>

Query flags to use when testing for collisions using the default [MoveChecker](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksconverginginputpredictor/ks.reactor.client.ksconverginginputpredictor.movechecker.md) with a non-dynamic rigid body.

```csharp
public ksQueryFlags QueryFlags { get; set; }
```

#### Property Value

[ksQueryFlags](/reactor/api-reference/ks.reactor/ks.reactor.ksqueryflags.md)

### QueryObject <a href="#ks_reactor_client_ksconverginginputpredictor_queryobject" id="ks_reactor_client_ksconverginginputpredictor_queryobject"></a>

Query object (entity, collider, or shape) to use when testing for collisions using the default [MoveChecker](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksconverginginputpredictor/ks.reactor.client.ksconverginginputpredictor.movechecker.md). Not used if the entity is a dynamic rigid body. If null, collisions will not be tested if the entity is not a dynamic rigid body. Note that kinematic rigid bodies will test for collisions with dynamic rigid bodies when moving the render position to prevent overlapping with dynamic rigid bodies that will get pushed out of the way, even if this is null.

```csharp
public object QueryObject { get; set; }
```

#### Property Value

[object](https://learn.microsoft.com/dotnet/api/system.object)

### RequiresController <a href="#ks_reactor_client_ksconverginginputpredictor_requirescontroller" id="ks_reactor_client_ksconverginginputpredictor_requirescontroller"></a>

Always true; the converging input predictor requires a player controller.

```csharp
public bool RequiresController { get; }
```

#### Property Value

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

## Methods

### ClientUpdate(ksTransformState, Dictionary\<uint, ksMultiType>) <a href="#ks_reactor_client_ksconverginginputpredictor_clientupdate_ks_reactor_kstransformstate_system_collect" id="ks_reactor_client_ksconverginginputpredictor_clientupdate_ks_reactor_kstransformstate_system_collect"></a>

Updates the client transform and properties.

```csharp
public bool ClientUpdate(ksTransformState state, Dictionary<uint, ksMultiType> properties)
```

#### Parameters

`state` [ksTransformState](/reactor/api-reference/ks.reactor/ks.reactor.kstransformstate.md)

Client transform to update with new values.

`properties` [Dictionary](https://learn.microsoft.com/dotnet/api/system.collections.generic.dictionary-2)<[uint](https://learn.microsoft.com/dotnet/api/system.uint32), [ksMultiType](/reactor/api-reference/ks.reactor/ks.reactor.ksmultitype.md)>

Smoothed client properties to update with new values. Null if there are no smoothed properties.

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

If false, this function will not be called again until the server transform or a server property changes.

### Detached() <a href="#ks_reactor_client_ksconverginginputpredictor_detached" id="ks_reactor_client_ksconverginginputpredictor_detached"></a>

Returns inputs to their pool.

```csharp
public void Detached()
```

### Disabled() <a href="#ks_reactor_client_ksconverginginputpredictor_disabled" id="ks_reactor_client_ksconverginginputpredictor_disabled"></a>

Called when the predictor is disabled. May be called zero or more times. Called before [Detached](#KS_Reactor_Client_ksConvergingInputPredictor_Detached). When an entity switches between the [NonInputPredictor](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity.md#KS_Reactor_Client_ksBaseEntity_NonInputPredictor) and [InputPredictor](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity.md#KS_Reactor_Client_ksBaseEntity_InputPredictor), this is called on the one that was switched off.

```csharp
public void Disabled()
```

### Enabled() <a href="#ks_reactor_client_ksconverginginputpredictor_enabled" id="ks_reactor_client_ksconverginginputpredictor_enabled"></a>

Called when the predictor is enabled. May be zero or more times. Called after [Initialize](#KS_Reactor_Client_ksConvergingInputPredictor_Initialize_KS_Reactor_Client_ksBaseRoom_2cKS_Reactor_Client_ksBaseEntity_2cKS_Reactor_Client_ksBasePlayer_). When an entity switches between the [NonInputPredictor](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity.md#KS_Reactor_Client_ksBaseEntity_NonInputPredictor) and [InputPredictor](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity.md#KS_Reactor_Client_ksBaseEntity_InputPredictor), this is called on the one that was switched to.

```csharp
public void Enabled()
```

### Initialize(ksBaseRoom, ksBaseEntity, ksBasePlayer) <a href="#ks_reactor_client_ksconverginginputpredictor_initialize_ks_reactor_client_ksbaseroom_ks_reactor_clie" id="ks_reactor_client_ksconverginginputpredictor_initialize_ks_reactor_client_ksbaseroom_ks_reactor_clie"></a>

Initializes the predictor.

```csharp
public bool Initialize(ksBaseRoom room, ksBaseEntity entity, ksBasePlayer player)
```

#### Parameters

`room` [ksBaseRoom](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseroom.md)

The room object.

`entity` [ksBaseEntity](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity.md)

Entity the predictor is smoothing. Null if the predictor is smoothing room or player properties.

`player` [ksBasePlayer](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseplayer.md)

Player the predictor is smoothing properties for. Null if the predictor is not smoothing player properties.

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

False if the predictor could not be initialized and needs to be removed.

### InputUpdate(ksInput) <a href="#ks_reactor_client_ksconverginginputpredictor_inputupdate_ks_reactor_ksinput" id="ks_reactor_client_ksconverginginputpredictor_inputupdate_ks_reactor_ksinput"></a>

Called when a new frame of input is generated. Only called for entities with player controllers.

```csharp
public void InputUpdate(ksInput input)
```

#### Parameters

`input` [ksInput](/reactor/api-reference/ks.reactor/ks.reactor.ksinput.md)

Input

### IsPredictedProperty(uint) <a href="#ks_reactor_client_ksconverginginputpredictor_ispredictedproperty_system_uint32" id="ks_reactor_client_ksconverginginputpredictor_ispredictedproperty_system_uint32"></a>

Does the predictor predict the property value with the given `propertyId`?

```csharp
public bool IsPredictedProperty(uint propertyId)
```

#### Parameters

`propertyId` [uint](https://learn.microsoft.com/dotnet/api/system.uint32)

Property id

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True if the predictor predicts the property value.

### MoveCheck(ksBaseEntity, ksVector3, ksVector3, bool) <a href="#ks_reactor_client_ksconverginginputpredictor_movecheck_ks_reactor_client_ksbaseentity_ks_reactor_ksv" id="ks_reactor_client_ksconverginginputpredictor_movecheck_ks_reactor_client_ksbaseentity_ks_reactor_ksv"></a>

Moves an entity between two points, checking for collisions along the way and doing sweep-and-slide movement and depenetrating from overlapping objects at the end. Use [QueryObject](#KS_Reactor_Client_ksConvergingInputPredictor_QueryObject), [QueryFilter](#KS_Reactor_Client_ksConvergingInputPredictor_QueryFilter), and [QueryFlags](#KS_Reactor_Client_ksConvergingInputPredictor_QueryFlags) if you need to test for collisions with a non-dynamic rigid body.

```csharp
public static ksVector3 MoveCheck(ksBaseEntity entity, ksVector3 startPosition, ksVector3 targetPosition, bool isRenderPosition)
```

#### Parameters

`entity` [ksBaseEntity](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity.md)

Entity to move

`startPosition` [ksVector3](/reactor/api-reference/ks.reactor/ks.reactor.ksvector3.md)

Entity starting position

`targetPosition` [ksVector3](/reactor/api-reference/ks.reactor/ks.reactor.ksvector3.md)

Position to move to.

`isRenderPosition` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

Will the result of this move be the position the entity is rendered at? If true and the `entity` is a kinematic rigid body and [CheckKinematicDynamicCollisions](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksconverginginputpredictor/ks.reactor.client.ksconverginginputpredictor.configdata.md#KS_Reactor_Client_ksConvergingInputPredictor_ConfigData_CheckKinematicDynamicCollisions) is true, queries will also check for collisions with dynamic rigid bodies that get pushed out of the way, to prevent the render position from embedding with dynamic objects.

#### Returns

[ksVector3](/reactor/api-reference/ks.reactor/ks.reactor.ksvector3.md)

Position to move the entity to.

### ParentChange(ksBaseEntity, ksBaseEntity) <a href="#ks_reactor_client_ksconverginginputpredictor_parentchange_ks_reactor_client_ksbaseentity_ks_reactor" id="ks_reactor_client_ksconverginginputpredictor_parentchange_ks_reactor_client_ksbaseentity_ks_reactor"></a>

Invoked when the Entity parent changes. This method should correct predicted values by converting the positions back to world positions for the removal of the old parent and then to the local position for the new parent.

```csharp
public void ParentChange(ksBaseEntity oldParent, ksBaseEntity newParent)
```

#### Parameters

`oldParent` [ksBaseEntity](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity.md)

Parent entity being removed.

`newParent` [ksBaseEntity](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksbaseentity.md)

Parent entity being added.

### ServerUpdate(ksReadOnlyTransformState, Dictionary\<uint, ksMultiType>, bool, bool) <a href="#ks_reactor_client_ksconverginginputpredictor_serverupdate_ks_reactor_ksreadonlytransformstate_system" id="ks_reactor_client_ksconverginginputpredictor_serverupdate_ks_reactor_ksreadonlytransformstate_system"></a>

Called once per server frame.

```csharp
public bool ServerUpdate(ksReadOnlyTransformState state, Dictionary<uint, ksMultiType> properties, bool teleported, bool idle)
```

#### Parameters

`state` [ksReadOnlyTransformState](/reactor/api-reference/ks.reactor/ks.reactor.ksreadonlytransformstate.md)

Server transform data.

`properties` [Dictionary](https://learn.microsoft.com/dotnet/api/system.collections.generic.dictionary-2)<[uint](https://learn.microsoft.com/dotnet/api/system.uint32), [ksMultiType](/reactor/api-reference/ks.reactor/ks.reactor.ksmultitype.md)>

Smoothed properties whose values changed since the last frame. Null if no properties have changed.

`teleported` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

Did the entity teleport?

`idle` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True if there were no transform or property changes since the last frame.

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

If false and `idle` is true, this function will not be called again until the server transform or a server property changes.
