Skip to content

five-on-it / packages/net-client/src/smoothing / SmoothingOffset

Class: SmoothingOffset ​

Defined in: packages/net-client/src/smoothing.ts:42

Exponentially decaying position offset.

Constructors ​

Constructor ​

new SmoothingOffset(): SmoothingOffset

Returns ​

SmoothingOffset

Properties ​

snapped ​

snapped: number = 0

Defined in: packages/net-client/src/smoothing.ts:50

Corrections taken at once so far (past the bound of the pace, or the teleport's).


x ​

x: number = 0

Defined in: packages/net-client/src/smoothing.ts:44

Current offset x (m).


y ​

y: number = 0

Defined in: packages/net-client/src/smoothing.ts:46

Current offset y (m).


z ​

z: number = 0

Defined in: packages/net-client/src/smoothing.ts:48

Current offset z (m).

Methods ​

add() ​

add(dx, dy, dz, pace?, maxSmoothed?): void

Defined in: packages/net-client/src/smoothing.ts:57

Adds a correction to ease away, unless it is more than the pace can hide (snapsAt at pace m/s; without a pace, only a correction above maxSmoothed metres, a teleport): then the offset is dropped and the body is drawn at its true pose.

Parameters ​

dx ​

number

dy ​

number

dz ​

number

pace? ​

number

maxSmoothed? ​

number = 3

Returns ​

void


decay() ​

decay(dt): void

Defined in: packages/net-client/src/smoothing.ts:72

Decays the offset by dt seconds.

Parameters ​

dt ​

number

Returns ​

void