After fixing an issue with frames per second affecting the recoil, sway and bobble of my viewmodels, this new weird issue had arisen.
There is an unusual jitterness to the viewmodel, I believe this has to do with the second line of code in this module script:
function module.update(viewmodel, dt, RecoilSpring, BobbleSpring, SwaySpring)
viewmodel:SetPrimaryPartCFrame(workspace.CurrentCamera.CFrame)
for i,v in pairs(viewmodel:GetChildren()) do
if v:IsA("MeshPart") or v:IsA("Part") then
v.CanCollide = false
end
end
local Bobble = Vector3.new(GetBobbing(10), GetBobbing(5), GetBobbing(5))
local MouseDelta = game:GetService("UserInputService"):GetMouseDelta()
local Character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
BobbleSpring:shove(Bobble / 10 * (Character.HumanoidRootPart.Velocity.Magnitude) / 10)
SwaySpring:shove(Vector3.new(-MouseDelta.X / 75, MouseDelta.Y / 75, 0))
local UpdatedRecoilSpring = RecoilSpring:update(dt)
local UpdatedBobbleSpring = BobbleSpring:update(dt)
local UpdatedSwaySpring = SwaySpring:update(dt)
viewmodel:SetPrimaryPartCFrame(viewmodel:GetPrimaryPartCFrame():ToWorldSpace(CFrame.new(UpdatedBobbleSpring.Y, UpdatedBobbleSpring.X, 0)))
viewmodel:SetPrimaryPartCFrame(viewmodel:GetPrimaryPartCFrame() * CFrame.new(UpdatedSwaySpring.X, UpdatedSwaySpring.Y, 0))
viewmodel:SetPrimaryPartCFrame(viewmodel:GetPrimaryPartCFrame() * CFrame.Angles(math.rad(UpdatedRecoilSpring.X), math.rad(UpdatedRecoilSpring.Y), 0))
workspace.Camera.CFrame *= CFrame.Angles(math.rad(UpdatedRecoilSpring.X), math.rad(UpdatedRecoilSpring.Y), math.rad(UpdatedRecoilSpring.Z))
end
Here’s the local script in the gun tool:
RunService.Heartbeat:Connect(function(dt)
if Viewmodel then
MainModule.update(Viewmodel, dt, RecoilSpring, BobbleSpring, SwaySpring)
end
end)
Here’s the jitterness im talking about…
Anything would be helpful, thanks!