-
What do you want to achieve?
I want for my head bobbing to bob the camera smoothly. The camera bobbing is basically bouncing on the Y axis. -
What is the issue?
Since the bobbing is running on tick() which goes on forever and when walking is pretty noticeable when the camera hops high and doing the head bobbing cycle. -
What solutions have you tried so far?
I tried seeing some videos and the Devforum but I couldn’t find what I want.
-- hum = the humanoid of the local player
local function bob()
if hum.MoveDirection.Magnitude > 0 and hum.Sit == false then
local currentTime = tick()
local bobbleY = math.abs(math.sin(currentTime * 5)) * .5
local bobble = Vector3.new(0, bobbleY, 0)
hum.CameraOffset = hum.CameraOffset:lerp(bobble, 1)
else
hum.CameraOffset = hum.CameraOffset * .75
end
end