Movement Replication using Lerp

Hi,

So the situation is that a player needs to be able to hold a ball. I don’t want to just attach the ball to the player or to his bones. I want the ball to lerp smoothly to a player’s ballposition. This position is defined by an arrow component attached to the player. This all works fine (replicated and everything). The server keeps track of the ball position at all times so the server is basically just telling the ball where to go and the clients see the result. But this movement appears very jittery for all the clients. If the player throws the ball, unreal’s physics take over and everything is replicated smoothly. But as soon as I’m forcing the ball to lerp to the player’s ballposition, the movement appears jittery.

The thing is… Up untill now I’ve only been able to get the smooth lerp movement I want using setworldlocation, I tried using physics but eventually the ball always ended up orbiting around the players ballposition.

So my question is… Is there a way to create the same smooth lerp movement without using a setworldlocation node or can the client’s perception of the ball be smoothed out using the positions the server feeds the clients and interpolating over them?

Thanks in advance!! :slight_smile:

Scott

Instead of feeding clients positional information every packet, you can feed them velocity or input information.

That way, you can run the movement code on the client with the information on the server. This will replicate movement, instead of position.

Thanks for the super fast reply!

So are you suggesting that the server should calculate the ball’s next position and the client should make the ball move on his screen and afterwards update the server about it?

Well, not exactly.

Whichever client owns the ball should tell the server that it has been given movement input.

the client then gives the ball the movement input

the server then tells every other client that the ball has been given movement input

every other client then gives the movement input to the ball.