RunService.RenderStepped:Connect(function()
ViewModel.Torso.CFrame = Camera.CFrame -- Set viewmodel cframe to camera cframe
if Character:FindFirstChildWhichIsA("Tool") and Humanoid.MoveDirection.Magnitude > 0 then
-- player is moving with a tool equipped
local currentCF = Camera.CFrame
local x = math.cos(tick() * 3) * 0.2
local y = math.abs(math.sin(tick() * 5)) * 0.1
local cf = currentCF * CFrame.new(x, y, 0)
ViewModel.Torso.CFrame = cf
end
end)
The gun bobbing here works perfectly fine in my fps viewmodel, however once the player stops moving, it immediately goes back to the camera cframe which looks very jarring. https://gyazo.com/625e2f87bf81b3e9eb02e8ce6ceb3e49
I had originally tried using the given example in this article to shift the viewmodel back smoothly.
(This part specifically)
I’m not sure what’s the problem here, but if you want to, you should just use the spring module for bobbing. I can give you the bobbing code example if you’d like to.