Class HitClaimGeometry
The arithmetic the server uses to decide whether a hit the owner claims (see HitClaimVictim) could have been what the owner saw.
public static class HitClaimGeometry
- Inheritance
-
HitClaimGeometry
- Inherited Members
Remarks
What is being bounded. The owner resolves its projectile against characters where it draws them; the server resolves the same sweep against where its position history says they were drawn. The history reproduces the owner's view exactly while a character moves steadily and its updates arrive on time. It cannot when the owner drew something the server never had: the straight line between two position updates two ticks apart while the character turned between them, a character held at its last update because the next was late, a position rounded to the wire's centimetre grid. Every one of those errors is a DISTANCE THE CHARACTER MOVED over a tick or two, so the tolerance is a small constant plus a few ticks of the victim's own speed: a character standing still gets almost none, because nothing about a still character can have been drawn elsewhere.
Why geometry and not a physics query. The check needs one distance between one swept shape and one character, against a pose out of the history. Moving the character there, syncing physics and casting would cost a rewind scope for an answer two segments give exactly, and could not be tested without a physics scene.
Fields
BaseTolerance
Tolerance every claim gets, in metres: the wire grid, the claim's sixteenth-of-a-tick hold, float noise.
public const float BaseTolerance = 0.1
Field Value
MaximumTolerance
The most the tolerance grows to, in metres, however fast the victim was moving.
public const float MaximumTolerance = 1.5
Field Value
ToleranceTicksOfMovement
Ticks of the victim's own movement a claim may be off by.
public const float ToleranceTicksOfMovement = 2.5
Field Value
Remarks
Two for the straight line a client draws between updates two ticks apart, and a half for an update that arrived inside the playback margin. A character that outran this was drawn somewhere the connection, not the aim, put it; the claim is refused and the server's own sweep stands.
Methods
Gap(Vector3, Vector3, float, Vector3, Vector3, float, float, out Vector3, out Vector3)
The clear distance between an object swept from from to to and an upright
character: zero when they touch or overlap.
public static float Gap(Vector3 from, Vector3 to, float shapeReach, Vector3 victimFeet, Vector3 victimUp, float victimRadius, float victimHeight, out Vector3 pointOnVictim, out Vector3 normal)
Parameters
fromVector3Where the sweep began.
toVector3Where it ended.
shapeReachfloatThe swept shape's size about its centre (its largest half extent).
victimFeetVector3The character's position (its feet).
victimUpVector3The character's up.
victimRadiusfloatThe character's capsule radius.
victimHeightfloatThe character's capsule height.
pointOnVictimVector3The point on the character's surface nearest the sweep.
normalVector3From that point toward the sweep.
Returns
SegmentDistance(Vector3, Vector3, Vector3, Vector3, out Vector3, out Vector3)
The shortest distance between two segments, and the points on each where it is reached.
public static float SegmentDistance(Vector3 p1, Vector3 q1, Vector3 p2, Vector3 q2, out Vector3 c1, out Vector3 c2)
Parameters
p1Vector3q1Vector3p2Vector3q2Vector3c1Vector3c2Vector3
Returns
Tolerance(float, float)
How far a claim's victim may be from the object's swept path and still be accepted.
public static float Tolerance(float victimSpeed, float tickDelta)
Parameters
victimSpeedfloatThe victim's speed at the moment claimed, metres a second, from the history.
tickDeltafloatSeconds per tick.