Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Bug Does SmoothRigidBodiesGraphicalMotion only support tickRate == TimeStep?

Discussion in 'NetCode for ECS' started by Jawsarn, Jan 12, 2024.

  1. Jawsarn

    Jawsarn

    Joined:
    Jan 12, 2017
    Posts:
    245
    SmoothRigidBodiesGraphicalMotion uses MostRecentFixedTime.ElapsedTime to calculate timeAhead which is normalized by timeStep. This is recorded from RecordMostRecentFixedTime which is in PhysicsSystemGroup.

    The interpolation in the SmoothMotionsJob uses PhysicsGraphicalInterpolationBuffer.previousTransform which is recorded in BufferInterpolatedRigidBodiesMotion which is in PhysicsSystemGroup.

    If you would have a 2x TimeStep by tickRate you would run the PhyiscsSystemGroup twice on a tick, meaning both RecordMostRecentFixedTime and BufferInterpolatedRigidBodiesMotion would run twice, and only record the latest values. This would mean that later in the SmoothRigidBodiesGraphicalMotion, it would only interpolate between the second half of the expected interpolation.