Skip to content

Instantly share code, notes, and snippets.

@buesing
Created June 28, 2019 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buesing/721c34c5f0af32536671205d444e7ba9 to your computer and use it in GitHub Desktop.
Save buesing/721c34c5f0af32536671205d444e7ba9 to your computer and use it in GitHub Desktop.
// we interpolate between the actual (received) position and the position
// the user would expect. after 500ms both positions are the same.
const fauxPosition = new Vector3().lerpVectors(
this.physics.ball.position,
new Vector3().addVectors(
this.physics.ball.position,
this.ballPositionDifference
),
this.ballInterpolationAlpha
);
this.ball.position.copy(fauxPosition);
this.ball.quaternion.copy(this.physics.ball.quaternion);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment