Vixen
02b45cc4
csharp
public struct PredictionSmoothing

Hides a rollback by letting an entity's visuals lag the body they hang from.

Read the guide page for this →

Remarks

On a child, and that is the whole of the design. A correction moves the predicted body at once, because the simulation has to be right; what a player sees may lag and catch up. So the offset goes on a visual child — the mesh, the skeleton root — which the transform hierarchy composes and which nothing simulates. Unreal does exactly this in SmoothClientPosition: it offsets the mesh component and never the capsule.

⚠ Writing the offset onto the body instead would feed it back into the simulation. PhysicsScene adopts a written LocalTransform as a teleport — that is what makes a rollback reach a CharacterController at all — so a smoothed body position would be taken as the truth on the next fixed step, and the error the smoothing was hiding would become an error the simulation had made. The correction would then never settle.

Not [DataContract], because it names an entity. A prefab therefore carries the mesh as a child and something running in the world says which body it belongs to — the line CameraTargets and Possessing are already on.

Fields and properties (2)

  • public Entity Body

    The predicted entity whose correction this hides. Usually the parent.

  • public Vector3 Rest

    Where the visuals sit when nothing is being smoothed, in the parent's frame.

Methods (1)

Used by (2)

  • PredictionSmoothingSystemVixen.Net.Engine
  • PredictionSmoothingTestsVixen.Net.Engine.Tests