Vixen
02b45cc4
csharp
public struct PhysicsInterpolation

Where the body was at the last two steps, so the renderer can draw somewhere between them.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

A 60 Hz simulation drawn at 144 Hz shows each step twice and then once, which reads as a stutter no amount of frame pacing fixes — the object really is in the same place for two frames. Interpolating between the last two steps by the accumulator's alpha is what makes it smooth, and it is why FixedStepAccumulator has an Alpha at all.

The cost is that what is drawn is always one step behind the simulation. That is the right trade for everything except a camera bolted to the player, which should read the body directly.

Fields and properties (4)

  • public Vector3 PreviousPosition

    Where the body was at the end of the previous step.

  • public Quaternion PreviousRotation

    Which way it faced at the end of the previous step.

  • public Vector3 CurrentPosition

    Where the body is at the end of the current step.

  • public Quaternion CurrentRotation

    Which way it faces at the end of the current step.

Used by (7)

  • PlayerRigThirdPersonShooter
  • CharacterMovementSystemVixen.Physics
  • PhysicsInterpolationSystemVixen.Physics
  • PhysicsSceneVixen.Physics
  • PhysicsSceneTestsVixen.Physics.Tests
  • PhysicsSyncSystemVixen.Physics
  • PhysicsWritebackSystemVixen.Physics