We do a lot of lerping in our networked application and sometimes the babylon lerp functions don’t jive well with the complexities of our app, which frequently sends updates about pos/rot.

I notice that there is a package for three.js that does buffered-interpolation, which is designed to work well “both in situations with continuous and sparse network updates”: InfiniteLee/buffered-interpolation: A class for interpolation of position, rotation, and scale for networked THREE.js objects. (github.com).

I’m wondering if this kind of thing might be in the works at Babylon, or if I don’t actually need something like this because I should be using _____ instead. All ears!

1 Like

I’m not aware of any other plug-in implementations, as it is usually very custom to a project.
Personally, I use my own serializer(when not using other networking libraries), which means I use schemas to determine whether or not a value should be interpolated, and how(quaternion, vector, integer etc). The example you linked has hardcoded position, quaternion and scale, and would benefit from a more modular approach. That being said, you could port that example to BabylonJS in five minutes and modify to your needs.


Thanks for the feedback here @Raggar !

Let us know how that works out and might be a nice addition to the babylon toolset :slight_smile:

Hi @sebavan , happy to say @FrameVRWill cooked this up: GitHub - virbela/buffered-interpolation: A class for interpolation of position, rotation, and scale for networked BabylonJS objects..


This is so cooooooool !!! would you mind adding someting in the babylon doc for it ??? cc @PirateJC


WOOT! This is rad! Nice work @FrameVRWill !!!

Yup on it! I’ll add a new page to the extensions section of the doc for this.


Ok new page created for this under extensions.

There’s not much to the page right now, just a description copied from the github readme

@FrameVRWill - How would you feel about adding a few details to the page? Maybe some instructions on how to get it set up and a small example? Is that doable?



Very cool contribution! :smiley:

Yo @FrameVRWill

I am trying to use this lib for default network bufferng, but still get crazy jitter

Do you have any real demos on actually using the component.

I have been trying to use it for my colyseus networking. But it is really jittery… Not smooth at all.
And hermite… jumps around like crazy.

Is there at least one working demo using this library in for networking…
Anything to show how you var calculating the velocity to appendBuffer, is is simple current position minus previous position ???

Are you sending client updates on a fixed interval or are using the regular render loop with delta time ?

So many questions :slight_smile:

We are using the lerp mode without velocity. Note that the bufferTime parameter to the constructor controls how much time the buffer will cover (in seconds). If this period is shorter than your update frequency, then you won’t get any interpolation at all.

I’m afraid I don’t have authorization to share our implementation, but, since this is a straightforward port from the open source Mozilla Hubs project, perhaps their implementation will be helpful:

1 Like