Camera Recoil being affected by FPS

The camera recoil is being increased if the player has a higher FPS and if the player has a lower FPS then the camera recoil is reduced

In my FPS game I have 2 things that edits camera movement

  1. Viewmodel Camera Part
  2. Recoil Spring

I already tried using deltatime but couldn’t figure out how to get it to work

Code:

-- Set Recoil
springs.recoil:shove(recoil)

-- RenderStepped (Both lines has these issues)
camera.CFrame = camera.CFrame * CFrame.Angles(math.rad(recoil.x), math.rad(recoil.y), math.rad(recoil.z))
camera.CFrame = camera.CFrame * viewmodel.HumanoidRootPart.CFrame:ToObjectSpace(viewmodel.CameraPart.CFrame)
2 Likes

maybe using this

-- Set Recoil

springs.recoil:shove(recoil)

game["Run Service"].Heartbeat:Connect(function(DeltaTime)

-- RenderStepped (Both lines has these issues)

camera.CFrame = camera.CFrame * CFrame.Angles(math.rad(recoil.x *DeltaTime), math.rad(recoil.y *DeltaTime), math.rad(recoil.z *DeltaTime))

workspace.C.CFrame = workspace.C.CFrame *workspace.Z.CFrame:ToObjectSpace(workspace.Z.CFrame.X,workspace.Z.CFrame.Y*DeltaTime,workspace.Z.CFrame.Z)

end)

I’m not sure I fixed the second line :pensive:

1 Like