I am trying to make a shoulder camera for a gun system I am making and I cannot get the character to move smoothly. So far I’ve tried to move the character on Heartbeat, Stepped, RenderStepped, and I’ve tried to tween the character and use a body gyro but to make the character move smoothly, but nothing works (tweening/body gyro is either too slow where it looks really bad or its too fast and still jittery).
I believe you can solve it by lerping the CFrame values in order to smoothen it out similar to tweening but not as linear like so. You can adjust the lerp alpha value in order to change how fast you lerp towards the current goal CFrame and such.
turnListen = runService.RenderStepped:Connect(function(step)
local camVector = camera.CFrame.LookVector
local rootCFrame = CFrame.new(root.Position, Vector3.new(camVector.X * 999, root.Position.Y, camVector.Z * 999))
local lerpAlpha = 0.25
root.CFrame = root.CFrame:Lerp(rootCFrame,lerpAlpha)
end)
Are you sure about that, where is this coming from? This resource seems to achieve what you are trying to do and it uses lerping to achieve the objectives and I think it’s pretty good.
Looking through the source code perhaps it’s not the only the root CFrame of the character that needs lerping but the camera as well.
--// Calculate new camera cframe //--
local newCameraCFrame = CFrame.new(humanoidRootPart.Position) *
CFrame.Angles(0, self.HorizontalAngle, 0) *
CFrame.Angles(self.VerticalAngle, 0, 0) *
CFrame.new(offset)
newCameraCFrame = currentCamera.CFrame:Lerp(newCameraCFrame, activeCameraSettings.LerpSpeed)