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
event.OnServerEvent:connect(function(c0)
for i = 1,10 do
neck.C0 = neck.C0:Lerp(c0, 0.1)
game:GetService("RunService").Heartbeat:wait()
end
end)
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?