How to create realistic viewmodel bob

  1. What do you want to achieve? Keep it simple and clear!

So i was making a simple and basic viewmodel bob system, quite like a U pattern, but i want to make it more realistic like in this clip from JustiNacho Roblox Spawn Animation Test:

Because iam a noob at trigonometry(sine,cos,etc), i couldn’t figure out how it works.

idek how to use geogebra :sob:

1 Like

you can use math.sin for this

example code, this’ll create a part and make it “bob”

local speed = 1
local intensity = 2

local part = Instance.new("Part",workspace)
part.Size = Vector3.new(1,1,1)
part.Anchored = true

game:GetService("RunService").HeartBeat:Connect(function() -- while true do loops should work too
local currenttick = tick()
local rollamount = math.sin(currenttick * speed) * intensity
part.CFrame = CFrame.new(part.Position) * CFrame.Angles(0,0,math.rad(rollamount))
end)
1 Like