fix: only on tick

This commit is contained in:
cha0s 2024-09-05 01:41:45 -05:00
parent 48a45533f5
commit a58e1b6b89

View File

@ -7,6 +7,7 @@ export default class Interpolator {
accept(state) { accept(state) {
const packet = state; const packet = state;
if ('Tick' !== packet.type) { if ('Tick' !== packet.type) {
postMessage(packet);
return; return;
} }
this.penultimate = this.latest; this.penultimate = this.latest;
@ -93,7 +94,7 @@ const interpolate = (now) => {
onmessage = async (event) => { onmessage = async (event) => {
interpolator.accept(event.data); interpolator.accept(event.data);
if (interpolator.penultimate) { if (interpolator.penultimate && 'Tick' === event.data.type) {
postMessage({ postMessage({
type: 'Tick', type: 'Tick',
payload: { payload: {