local function W()local W=Angle(seat.CFrame.lookVector,seat.Velocity)local b=seat.Velocity.Magnitude local K=((b*.02)*W)*.1 local v=RAND()*TAU local I=COS(v)*K local j=SIN(v)*K return V3(I,j,0)end local function b()dampCam.Goal=-seat.CFrame:vectorToObjectSpace(seat.RotVelocity)*.1 local b=dampCam:Update()dampShake.Goal=W()local K=CF(dampShake:Update())local v=dampRot:Update()v=ANG(0,v.X,0)*ANG(v.Y,0,0)return((ANG(0,0,mobileDeviceBank)*v)*ANG(b.X,b.Y,b.Z))*K end

local function GetCameraShake()
	local dragAngle = Angle(seat.CFrame.lookVector, seat.Velocity)
	local speed = seat.Velocity.Magnitude
	
	local shakeMagnitude = (speed * 0.02) * dragAngle * 0.1
	
	local theta = RAND() * TAU
	local x = COS(theta) * shakeMagnitude
	local y = SIN(theta) * shakeMagnitude
	--                   ^
	-- THE STARS ALIGN   ^   DUN DUN DUN
	--                   ^
	
	return V3(x, y, 0)
end


local function GetCameraRotation()
	
	-- Relative rotational velocity:
	dampCam.Goal = -seat.CFrame:vectorToObjectSpace(seat.RotVelocity) * 0.1
	local relRotVel = dampCam:Update()
	
	-- Camera shake offset:
	dampShake.Goal = GetCameraShake()
	local shake = CF(dampShake:Update())
	
	-- User view rotation:
	local viewRotation = dampRot:Update()
	viewRotation = ANG(0, viewRotation.X, 0) * ANG(viewRotation.Y, 0, 0)
	
	return ANG(0, 0, mobileDeviceBank) * viewRotation * ANG(relRotVel.X, relRotVel.Y, relRotVel.Z) * shake
	
end

