Camera 360 Roll Help

I’ve been trying to imitate this camera roll effect:

I’m not having much luck though as I either can’t preserve the cameras position or it bugs out and accumulates drift.

local function StartRollCamera()
	local start = tick()
	local duration = 0.5
	local conn
	conn = rs.RenderStepped:Connect(function()
		local alpha = math.clamp((tick() - start) / duration, 0, 1)
		local baseCFrame = camera.CFrame
		local roll = math.rad(360) * alpha
		camera.CFrame = baseCFrame * CFrame.Angles(roll, 0, 0)
		if alpha >= 1 then
			conn:Disconnect()
		end
	end)
end

You’re script doubled the rotation on the same base instead of incrementally applying it.

-- LocalScript in StarterPlayerScripts
local RunService = game:GetService("RunService")
local camera = workspace.CurrentCamera

local function RollCamera()
    local start = tick()
    local duration = 0.5
    local base = camera.CFrame
    local axis = base.RightVector
    
    local conn
    conn = RunService.RenderStepped:Connect(function()
        local elapsed = tick() - start
        local alpha = math.min(elapsed / duration, 1)
       
        camera.CFrame = base * CFrame.fromAxisAngle(axis, math.pi * 2 * alpha)
        
        if alpha >= 1 then
            conn:Disconnect()
        end
    end)
end

RollCamera()

forget this. i just realized i never saved the lookvector as a base and just kept stacking it. it’s still not perfect but ill hit my head against the wall a little more before asking for help again

I think I get the idea a bit more. I’m still having a little trouble keeping the cameras position inline with the player characters movement. I figured I could just use the cameras position and then apply the roll afterwards but I’m not familiar with fromAxisAngle and just assumed it applied a given rotation around a given vector3 but I’m getting crazy movements/rotations so I think my understanding might still be hella off.

local start = tick()
	local duration = 0.5
	local conn
	conn = rs.RenderStepped:Connect(function()
		local elapsed = tick() - start
		local alpha = math.min(elapsed / duration, 1)
		local roll = -(math.pi * 2 * alpha)
		camera.CFrame = CFrame.new(camera.CFrame.Position) * CFrame.fromAxisAngle(camera.CFrame.LookVector, roll)
		if alpha >= 1 then
			conn:Disconnect()
		end
	end)

It’s all good. Getting it rolling is all that matters.

yo do you think it’s a bit janky? i’ve been messing with smoothing and stuff but this is about as good as i think i can get it unless you or anyone else has any ideas

Looks great.. Maybe a bit too fast, but maybe not