So I am tweening the cframe of the arms through a CFrameValue to my camera but when I move left,right,back or forward it gives this like shaky effect!?
The movement code
local tween = TweenService:Create(CFrameValue, TweenInfo.new(.35, Enum.EasingStyle.Cubic), {Value = camera.CFrame - camera.CFrame.LookVector * 3})
tween:Play()
Arms:PivotTo(CFrameValue.Value)
if UserInputService:IsKeyDown(Enum.KeyCode.W) then
local LookVectorAdjusted = Vector3.new(camera.CFrame.LookVector.X, 0, camera.CFrame.LookVector.Z)
camera.CFrame = camera.CFrame + LookVectorAdjusted * movementSpeed * deltaTime
end
if UserInputService:IsKeyDown(Enum.KeyCode.A) then
local RightVectorAdjusted = Vector3.new(camera.CFrame.RightVector.X, 0, camera.CFrame.RightVector.Z)
camera.CFrame = camera.CFrame + RightVectorAdjusted * -movementSpeed * deltaTime
end
if UserInputService:IsKeyDown(Enum.KeyCode.S) then
local LookVectorAdjusted = Vector3.new(camera.CFrame.LookVector.X, 0, camera.CFrame.LookVector.Z)
camera.CFrame = camera.CFrame + LookVectorAdjusted * -movementSpeed * deltaTime
end
if UserInputService:IsKeyDown(Enum.KeyCode.D) then
local RightVectorAdjusted = Vector3.new(camera.CFrame.RightVector.X, 0, camera.CFrame.RightVector.Z)
camera.CFrame = camera.CFrame + RightVectorAdjusted * movementSpeed * deltaTime
end
You need to try Stepped or Heartbeat instead of RenderStepped because they run after certain things each frame happen. Heartbeat, for example, runs after the physics simulation completes.
I’ve made quite a few custom viewModels and have never experienced this issue. If you’re just moving the arms I highly recommend adding an invisible “head” and CFraming it to camera with RenderStepped and applying an offset. Make sure your arms are properly rigged and attach them to a rootPart which is welded to the head. Should be easily adjustable to work with general movement aswell rather than just looking.
Alright so I got it fixed, so basically i was updating the cameras position without any sort of smoothing or interpolation, so I used the lerp function and it’s nice a fluid now!