Interpolating joints

I’ve been looking into making a character tilt to face a mouse position, and then replicating the joint positions to the server. To avoid causing to much traffic on the server, I’m only sending updates every 0.1-0.2 seconds, and then having the server smoothly interpolate between the angles given.

Currently I’ve been moving the joints on the server via a for loop. Here is what I mean:

-- updates are sent by client every 0.2 seconds
for i = 1,10 do
neck.C0 = neck.C0:Lerp(c0, 0.1)

This has been working wonderfully, except I worry that it may not be very efficient to run 10+ steps while updating. During server lag spikes the interpolation may appear to jump or suddenly stop (this is expected, since heartbeat is linked to server fps/speed).

Essentially what I’m asking is, are their any other, more efficient ways to accomplish this smooth transition?

For one: I would use the tween service.
For two: try firing events with the c0 data to all clients and have them calculate it. If they can see the player, then they can perform the operation on that character’s head to make it animate.

So the client makes the joint changes, then sends those changes to server, server sends it to other clients? I think I’ll try this, thanks.

1 Like