Player shaking uncontrollably on other clients when CFrame being set by BindToRenderStep

Goal
I am making a system in which the players “lock on” to each other to engage in a combat system. Right now, the client sets the CFrame of the player’s character to be facing the opponent in a BindToRenderStep function. This works as intended.

Problem
However, when another player is locked on to you, sometimes (I’m assuming due to ping and whatnot) they jitter and shake a lot when walking. The code works properly on the server but it looks weird and jarring.

Attempted Solutions
I tried changing between Hearbeat, RenderStepped, and the current BindToRenderStep, all of which produce the exact same results.
I also tried setting your opponents CFrame in your own localscript since the client is faster. However, setting HumanoidRootPart.CFrame = CFrame.lookAt(HumanoidRootPart.Position, target) freezes them despite taking their position as the first argument. (I tried Heartbeat in this scenario as well)
I tried setting the orientation too but this just bugged out for many reasons.

If anyone has any suggestions for this let me know. If you need a video of it happening I can send that, or the whole script, but I think I’ve given enough information here.

Manually setting an assembly’s CFrame bypasses the built in physics interpolation, which can cause this jittering, and will be strongly tied to ping. You can write you own interpolation, but I don’t recommend it except maybe as an exercise in networking. A classic workaround is to instead use physics on the client to smooth out the movement. I’m not 100% sure using AlignOrientation would do this correctly, but its worth a shot.

1 Like

I will try AlignOrientation, thank you.

It 100% solved the issue. As simple as setting its CFrame to what I was originally setting the HumanoidRootPart’s CFrame too. I didn’t have to do any networking magic at all.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.