Vixen
02b45cc4
csharp
public sealed class BodyHistory

The last few poses of one body, oldest first.

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

Remarks

The same shape as CaptureRing in the replication layer and for the same reason — a fixed ring, written round, allocating once — but keyed and searched differently. That one is looked up by an exact tick, because a delta names the capture it was measured from. This one is looked up by a tick that falls between two entries, because nobody saw the world on a tick boundary.

Ticks are modular, so this cannot be a binary search. A Tick has no ordering — Tick's own remarks explain why it refuses to have one — and the ring holds at most a couple of dozen entries, so it is walked. Sorting or bisecting a modular sequence is the bug that reproduces once every two years of uptime.

Fields and properties (4)

  • public int Count

    How many poses are held.

  • public int Depth

    How many it can hold.

  • public BodyPose Newest

    The most recent pose. Undefined when Count is zero.

  • public BodyPose Oldest

    The furthest back it goes. Undefined when Count is zero.

Methods (4)

  • public BodyHistory(int depth)

    Creates a history.

  • public void Add(in BodyPose pose)

    Records where the body is now.

  • public bool TrySample(Tick at, float fraction, bool interpolate, out BodyPose pose)

    Where the body was at a tick, interpolating between the captures either side of it.

  • public void Clear()

    Forgets everything, for a body that has been re-used or a match that has restarted.

Used by (2)

  • LagCompensationTestsVixen.Net.Physics.Tests
  • LagCompensatorVixen.Net.Physics