local function x()local x=Angle(seat.CFrame.lookVector,seat.Velocity)local e=seat.Velocity.Magnitude local P=((e*.02)*x)*.1 local S=RAND()*TAU local j=COS(S)*P local s=SIN(S)*P return V3(j,s,0)end local function e()dampCam.Goal=-seat.CFrame:vectorToObjectSpace(seat.RotVelocity)*.1 local e=dampCam:Update()dampShake.Goal=x()local P=CF(dampShake:Update())local S=dampRot:Update()S=ANG(0,S.X,0)*ANG(S.Y,0,0)return((ANG(0,0,mobileDeviceBank)*S)*ANG(e.X,e.Y,e.Z))*P end
-- Simulate camera shake (not great, but works well enough for this):
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
