Is there anyway to fix shaky effect?

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

are you by chance not using renderstepped?

1 Like

I actually am using renderstepped, i also tried heartbeat gave the same effect :[

Have you tried using Stepped as well?

1 Like

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.

1 Like

@BIGHEAD_RIPOFF

Yeah I tried stepped, and it’s still doing the same thing

@SubtotalAnt8185 Stepped totally breaks everything and Heartbeat does the same shaky thing

I updated the movement code

if UserInputService:IsKeyDown(Enum.KeyCode.W) then
	speedForward = 250
elseif UserInputService:IsKeyDown(Enum.KeyCode.S) then
	speedForward = -250
else
	speedForward = 0
end
	
local RightVector = Vector3.new(camera.CFrame.RightVector.X, 0, camera.CFrame.RightVector.Z) * speedSideways * deltaTime
local LookVector = Vector3.new(camera.CFrame.LookVector.X, 0, camera.CFrame.LookVector.Z) * speedForward * deltaTime
TweenCamera(CFrame.new(camera.CFrame.Position + RightVector + LookVector) * CFrame.fromEulerAnglesYXZ(-currentAngle.X, -currentAngle.Y, 0))
	
Arms:PivotTo(camera.CFrame - camera.CFrame.LookVector * 3)

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.

Here’s a good tutorial on adding sway: How to make an FPS viewmodel part 3! Sway and reloading!

1 Like

This is actually my rig but yeah

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!

1 Like

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