I’ve been implementing a sort of custom movement system for my game and while changing the position of the character works perfectly, I’ve been having issues with rotating it along with the camera. I’m aiming for a smooth rotation like how the default Shift Lock works, but whatever I’ve tried makes it look desynchronized and jittery.

(ignore the framerate, studio’s recorder is pretty meh)
Here’s the relevant code:
local cam = workspace.CurrentCamera
local char = script.Parent
local run_s = game:GetService("RunService")
function update_camera(dt)
local cam_ray = cam:ViewportPointToRay(cam.ViewportSize.X / 2, cam.ViewportSize.Y / 2)
local v = cam_ray.Origin + cam_ray.Direction * 1000
char:PivotTo(CFrame.new(char:GetPivot().Position, v))
end
run_s:BindToRenderStep("Camera", Enum.RenderPriority.Camera.Value + 1, update_camera)
I should mention two things:
- The model’s pivot doesn’t need to replicate to the server since I’m planning for this to be a singleplayer only game and it doesn’t fit my use case.
- Another part of the code changes the model’s position with MoveTo before the update_camera function changes the pivot. I tried to set the rotation within the function that uses MoveTo (changing it to PivotTo) but that didn’t fix the issue. I don’t know if combining them would work as part of a solution since that function has a lower RenderPriority value than Camera, but it’s worth a try.
I’ve also tried changing the RenderPriority value and the jitter still remained. Any help is appreciated and thanks in advance.