The easiest way to LERP for an interval (LERP)

Hi all!

Let’s say I get updated mesh position data from the server 10 times per second. How then, in the simplest way, can I make the mesh move smoothly with a babylon?

Here is a simple example.

It uses an interval of 10 times per second. Here he looks twitchy. I would like it to move smoothly.

I’ve read other forum posts about this, but the solutions look very complicated. I would have preferred a solution in a couple of lines of code :slight_smile:

Thank you.

Sometimes, the only way to properly solve a problem is write more than a few lines of code :slight_smile: The easiest way to animate in Babylon would probably be CreateAndStartAnimation: Animation | Babylon.js Documentation which is a single line. :slight_smile:

1 Like

This may hekp as well

1 Like

Thanks for the answer! This solution really works, but it looks more like a crutch. I would not like to create animation ten/fifteen times per second

Thanks for the answer! Looks like a solution to the problem, but if it hits setInterval, it starts to twitch

Well, you did ask for few lines of code, so that’s what I gave you. :slight_smile: You can simply extend this method by “batching” the received positions into one longer animation.

1 Like