I’m using a resource that achieves the camera sway I want except for one thing, when you start walking it instantly starts, after you stop walking it instantly stops, I find this a bit jarring and strange to look at, and instead I want it to start up and slow down and stop in the middle depending on where it is, basically;
- Start walking, camera sways
- Stop walking and the camera levels out to the middle.
This is what I have at the moment:
It might be a bit hard to notice, but its still kind of strange to look at, heres the code I’m using to make this effect, if you can figure out a way to smoothen it, that’d be great, thanks!
wait(0.1)
local cam = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer
local char = player.Character
local rs = game:GetService("RunService")
local lastTick = tick()
local t = 0
local headPos = char.Torso.Neck.C0
local running = false
char.Humanoid.Running:connect(function(speed)
running = speed > 0
end)
while true do
rs.RenderStepped:wait()
local dt = tick()-lastTick
if running then
t = t+dt
char.Torso.Neck.C0 = headPos * CFrame.new(math.cos(t*8)*0.1, 0, math.abs(math.sin(t*8))*0.1)
local look = cam.CoordinateFrame.lookVector
cam.CoordinateFrame = CFrame.new(cam.CoordinateFrame.p, cam.CoordinateFrame.p+look) * CFrame.Angles(0, 0, math.rad(math.cos(t*9)))
end
lastTick = tick()
end