Struct RewindTarget
A point in the past to rewind the world to: a whole tick, plus how far before that tick the target actually sits.
public readonly struct RewindTarget
- Inherited Members
Remarks
A bare tick was not enough to reproduce what a client saw. Its view of a peer is produced by NetworkTransform interpolation, which blends between two received snapshots and lands somewhere between two ticks — so a rewind quantised to a tick boundary reproduces a position the client never displayed. At 6 m/s one tick is 20 cm, which is the difference between a hit and a miss on a capsule.
SubTickFraction is in [0,1) and measured backwards, so
Tick = 100, SubTickFraction = 0.25 means "a quarter of a tick before tick 100" — that
is, 75% of the way from tick 99 to tick 100. Zero means exactly on the tick, which is what
every caller that has no sub-tick information should use.
Constructors
RewindTarget(uint, float)
public RewindTarget(uint tick, float subTickFraction = 0)
Parameters
Fields
IsValid
True when this target names a real tick.
public readonly bool IsValid
Field Value
SubTickFraction
How far before Tick the target sits, in ticks, in [0,1).
public readonly float SubTickFraction
Field Value
Tick
The whole tick the target sits on or just before.
public readonly uint Tick
Field Value
Properties
AsFractionalTick
The target as a fractional tick, for logging and tests.
public double AsFractionalTick { get; }
Property Value
None
A target that names nothing; callers should not rewind.
public static RewindTarget None { get; }
Property Value
Methods
GetBounds(out uint, out uint, out float)
The two ticks this target lies between, and how far along it sits.
public void GetBounds(out uint olderTick, out uint newerTick, out float alpha)
Parameters
olderTickuintThe tick immediately before the target (or the target's own tick).
newerTickuintThe tick immediately after the target (or the target's own tick).
alphafloatInterpolation weight from
olderTicktowardnewerTick.
Remarks
With a zero fraction both bounds are Tick and alpha is 1,
so a caller with no sub-tick information resolves exactly the sample it asked for.