Setting Up Your Object

This work flow is specific to Prediction v1. Version 2 will be significantly easier to use. Version 2 is nearing completion and a new guide will be made upon release.

To use CSP your object must be configured in potentially a different way from how you normally would. Although, the process is straight forward.

When creating your character, or object, the graphical parts must be a child object, while the CSP scripts will remain on the root. Here's an example of a hierarchy structure using a CharacterController.

Added is the CSPMotor script which you've been seeing code snippets from, a CharacterController component to move the character, a NetworkTransform to synchronize movements to other players, and a PredictedObject component to smooth out de-synchronizations.

If your motor depends upon a rigidbody you do not include a NetworkTransform component. The PredictedObject component will handle rigidbody synchronization with spectators after you change the Prediction Type.

You may configure the interval, interpolation, ect on the NetworkTransform to your liking. Client authoritative settings are updated automatically when PredictedObject has Prediction Type set to Other, and when you specify your NetworkTransform.

On the PredictedObject the child transform of Model is set as the Graphical Object. This is object that will be smoothed when a de-synchronization occurs.

Prediction Type is set to other, where if you were using a Rigidbody you would choose one of the two Rigidbody options.

Learn more about the PredictedObject component.

A common problem many run into when using prediction is graphical disburbances, usually in the camera. This is often seen as jitter, especially when using Cinemachine cameras. When setting up your camera be sure to follow the Graphical Object, and run the camera in LateUpdate.

Generally the described camera setup will work for many, but not necessarily all. Some configurations are unique and may require additional work. Feel free to ask for help in our server if you need it!

Very simply your object is now setup.

Last updated