herm-js-network
v0.3.5
Published
Herm-js network tool package for powerful network packet transmission.
Downloads
7
Maintainers
Readme
Herm network tools
Collection of network wrappers for Herm
Network compensator
Allow you to interpolate values based on time thought network calls.
import { NetworkCompensator } from 'herm-js';
const characterPosition = {
x: new NetworkCompensator(0),
y: new NetworkCompensator(0),
z: new NetworkCompensator(0),
};
network.onValue((position) => {
characterPosition.x.set(position),
characterPosition.y.set(position),
characterPosition.z.set(position),
});
...
// even if no network update is received, Herm interpolate and guess the next value
requestAnimationFrame(() => character.setPosition(characterPosition));