JSPM

buffered-interpolation

0.2.5
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 34
  • Score
    100M100P100Q70084F
  • License MPL-2.0

A class for handling interpolation of networked THREE.js objects.

Package Exports

  • buffered-interpolation

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (buffered-interpolation) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

buffered-interpolation

This package aims to provide a solution for interpolation of position, rotation, and scale for networked THREE.js objects.

It specifically aims to work well both in situations with continuous and sparse network updates.

Inspired by: godot-snapshot-interpolation-demo

For position and scale, uses either linear interpolation (default) or hermite function (which takes into account velocity).

For rotation (quaternions), uses spherical interpolation.

Usage

var InterpolationBuffer = require('buffered-interpolation');
let interpolationBuffer = new InterpolationBuffer();

on receipt of networked data:

interpolationBuffer.setPosition(new THREE.Vector3(data.x, data.y, data.z));

in some update/tick method:

object3d.position.copy(interpolationBuffer.getPosition());