local p=math.rad(80)local y=math.rad(0)local h=require(script.Parent:WaitForChild("\066\097\115\101\067\097\109\101\114\097"))local X=require(script.Parent:WaitForChild("\067\097\109\101\114\097\073\110\112\117\116"))local K=require(script.Parent:WaitForChild("\067\097\109\101\114\097\085\116\105\108\115"))local N=require(script.Parent:WaitForChild("\090\111\111\109\067\111\110\116\114\111\108\108\101\114"))local U=require(script:WaitForChild("\086\101\104\105\099\108\101\067\097\109\101\114\097\067\111\114\101"))local V=require(script:WaitForChild("\086\101\104\105\099\108\101\067\097\109\101\114\097\067\111\110\102\105\103"))local d=(game:GetService("\080\108\097\121\101\114\115")).LocalPlayer local w=K.map local P=.016666666666667;(game:GetService("\082\117\110\083\101\114\118\105\099\101")).Stepped:Connect(function(p,y)P=y end)local m=setmetatable({},h)m.__index=m function m.new()local p=setmetatable(h.new(),m)p:Reset()return p end local g=K.Spring function m.Reset(p)p.vehicleCameraCore=U.new(p:GetSubjectCFrame())p.pitchSpring=g.new(0,-math.rad(V.pitchBaseAngle))p.yawSpring=g.new(0,y)p.lastPanTick=0 local h=workspace.CurrentCamera local X=h and h.CameraSubject assert(h)assert(X)assert(X:IsA("\086\101\104\105\099\108\101\083\101\097\116"))local N,d=K.getLooseBoundingSphere(X:GetConnectedParts(true))p.assemblyRadius=math.max(d,.001)p.assemblyOffset=X.CFrame:Inverse()*N p:_StepInitialZoom()end function m._StepInitialZoom(p)p:SetCameraToSubjectDistance(math.max(N.GetZoomRadius(),p.assemblyRadius*V.initialZoomRadiusMul))end local u=K.sanitizeAngle local t=K.mapClamp function m._StepRotation(y,h,K)local N=y.yawSpring local U=y.pitchSpring local d=X.getRotation(true)N.pos=u(N.pos+-d.X)U.pos=u(math.clamp(U.pos+-d.Y,-p,p))if X.getRotationActivated()then y.lastPanTick=os.clock()end local w=-math.rad(V.pitchBaseAngle)local P=math.rad(V.pitchDeadzoneAngle)if V.autocorrectDelay<os.clock()-y.lastPanTick then local p=t(K,V.autocorrectMinCarSpeed,V.autocorrectMaxCarSpeed,0,V.autocorrectResponse)N.freq=p U.freq=p if N.freq<.001 then N.vel=0 end if U.freq<.001 then U.vel=0 end if math.abs(u(w-U.pos))<=P then U.goal=U.pos else U.goal=w end else N.freq=0 N.vel=0 U.freq=0 U.vel=0 U.goal=w end return CFrame.fromEulerAnglesYXZ(U:step(h),N:step(h),0)end function m._GetThirdPersonLocalOffset(p)return p.assemblyOffset+Vector3.new(0,p.assemblyRadius*V.verticalCenterOffset,0)end function m._GetFirstPersonLocalOffset(p,y)local h=d.Character if h and h.Parent then local p=h:FindFirstChild("\072\101\097\100")if p and p:IsA("\066\097\115\101\080\097\114\116")then return y:Inverse()*p.Position end end return p:_GetThirdPersonLocalOffset()end local function L(p,y)return math.abs(y.YVector:Dot(p))end local function T(p,y)return math.abs(y.XVector:Dot(p))end function m.Update(p)local y=workspace.CurrentCamera local h=y and y.CameraSubject local X=p.vehicleCameraCore assert(y)assert(h)assert(h:IsA("\086\101\104\105\099\108\101\083\101\097\116"))P=0 local K=p:GetSubjectCFrame()local N=p:GetSubjectRotVelocity()local U=L(N,K)local V=T(N,K)local d=p:StepZoom()local w=p:_StepRotation(P,math.abs((p:GetSubjectVelocity()):Dot(K.ZVector)))local m=t(d,.5,p.assemblyRadius,1,0)local g=(p:_GetThirdPersonLocalOffset()):Lerp(p:_GetFirstPersonLocalOffset(K),m)X:setTransform(K)local u=(CFrame.new(K*g)*X:step(P,V,U,m))*w return u*CFrame.new(0,0,d),u end function m.ApplyVRTransform(p) end function m.EnterFirstPerson(p)p.inFirstPerson=true p:UpdateMouseBehavior()end function m.LeaveFirstPerson(p)p.inFirstPerson=false p:UpdateMouseBehavior()end return m


local v1 = math.rad(80);
local v2 = math.rad(0);
local v3 = require(script.Parent:WaitForChild("BaseCamera"));
local v4 = require(script.Parent:WaitForChild("CameraInput"));
local v5 = require(script.Parent:WaitForChild("CameraUtils"));
local v6 = require(script.Parent:WaitForChild("ZoomController"));
local v7 = require(script:WaitForChild("VehicleCameraCore"));
local v8 = require(script:WaitForChild("VehicleCameraConfig"));
local l__LocalPlayer__9 = game:GetService("Players").LocalPlayer;
local l__map__10 = v5.map;
local u1 = 0.016666666666666666;
game:GetService("RunService").Stepped:Connect(function(p1, p2)
	u1 = p2;
end);
local v11 = setmetatable({}, v3);
v11.__index = v11;
function v11.new()
	local v12 = setmetatable(v3.new(), v11);
	v12:Reset();
	return v12;
end;
local l__Spring__2 = v5.Spring;
function v11.Reset(p3)
	p3.vehicleCameraCore = v7.new(p3:GetSubjectCFrame());
	p3.pitchSpring = l__Spring__2.new(0, -math.rad(v8.pitchBaseAngle));
	p3.yawSpring = l__Spring__2.new(0, v2);
	p3.lastPanTick = 0;
	local l__CurrentCamera__13 = workspace.CurrentCamera;
	local v14 = l__CurrentCamera__13 and l__CurrentCamera__13.CameraSubject;
	assert(l__CurrentCamera__13);
	assert(v14);
	assert(v14:IsA("VehicleSeat"));
	local v15, v16 = v5.getLooseBoundingSphere((v14:GetConnectedParts(true)));
	p3.assemblyRadius = math.max(v16, 0.001);
	p3.assemblyOffset = v14.CFrame:Inverse() * v15;
	p3:_StepInitialZoom();
end;
function v11._StepInitialZoom(p4)
	p4:SetCameraToSubjectDistance(math.max(v6.GetZoomRadius(), p4.assemblyRadius * v8.initialZoomRadiusMul));
end;
local l__sanitizeAngle__3 = v5.sanitizeAngle;
local l__mapClamp__4 = v5.mapClamp;
function v11._StepRotation(p5, p6, p7)
	local l__yawSpring__17 = p5.yawSpring;
	local l__pitchSpring__18 = p5.pitchSpring;
	local v19 = v4.getRotation(true);
	l__yawSpring__17.pos = l__sanitizeAngle__3(l__yawSpring__17.pos + -v19.X);
	l__pitchSpring__18.pos = l__sanitizeAngle__3(math.clamp(l__pitchSpring__18.pos + -v19.Y, -v1, v1));
	if v4.getRotationActivated() then
		p5.lastPanTick = os.clock();
	end;
	local v20 = -math.rad(v8.pitchBaseAngle);
	local v21 = math.rad(v8.pitchDeadzoneAngle);
	if v8.autocorrectDelay < os.clock() - p5.lastPanTick then
		local v22 = l__mapClamp__4(p7, v8.autocorrectMinCarSpeed, v8.autocorrectMaxCarSpeed, 0, v8.autocorrectResponse);
		l__yawSpring__17.freq = v22;
		l__pitchSpring__18.freq = v22;
		if l__yawSpring__17.freq < 0.001 then
			l__yawSpring__17.vel = 0;
		end;
		if l__pitchSpring__18.freq < 0.001 then
			l__pitchSpring__18.vel = 0;
		end;
		if math.abs(l__sanitizeAngle__3(v20 - l__pitchSpring__18.pos)) <= v21 then
			l__pitchSpring__18.goal = l__pitchSpring__18.pos;
		else
			l__pitchSpring__18.goal = v20;
		end;
	else
		l__yawSpring__17.freq = 0;
		l__yawSpring__17.vel = 0;
		l__pitchSpring__18.freq = 0;
		l__pitchSpring__18.vel = 0;
		l__pitchSpring__18.goal = v20;
	end;
	return CFrame.fromEulerAnglesYXZ(l__pitchSpring__18:step(p6), l__yawSpring__17:step(p6), 0);
end;
function v11._GetThirdPersonLocalOffset(p8)
	return p8.assemblyOffset + Vector3.new(0, p8.assemblyRadius * v8.verticalCenterOffset, 0);
end;
function v11._GetFirstPersonLocalOffset(p9, p10)
	local l__Character__23 = l__LocalPlayer__9.Character;
	if l__Character__23 and l__Character__23.Parent then
		local l__Head__24 = l__Character__23:FindFirstChild("Head");
		if l__Head__24 and l__Head__24:IsA("BasePart") then
			return p10:Inverse() * l__Head__24.Position;
		end;
	end;
	return p9:_GetThirdPersonLocalOffset();
end;
local function u5(p11, p12)
	return math.abs(p12.YVector:Dot(p11));
end;
local function u6(p13, p14)
	return math.abs(p14.XVector:Dot(p13));
end;
function v11.Update(p15)
	local l__CurrentCamera__25 = workspace.CurrentCamera;
	local v26 = l__CurrentCamera__25 and l__CurrentCamera__25.CameraSubject;
	local l__vehicleCameraCore__27 = p15.vehicleCameraCore;
	assert(l__CurrentCamera__25);
	assert(v26);
	assert(v26:IsA("VehicleSeat"));
	u1 = 0;
	local v28 = p15:GetSubjectCFrame();
	local v29 = p15:GetSubjectRotVelocity();
	local v30 = u5(v29, v28);
	local v31 = u6(v29, v28);
	local v32 = p15:StepZoom();
	local v33 = p15:_StepRotation(u1, (math.abs(p15:GetSubjectVelocity():Dot(v28.ZVector))));
	local v34 = l__mapClamp__4(v32, 0.5, p15.assemblyRadius, 1, 0);
	local v35 = p15:_GetThirdPersonLocalOffset():Lerp(p15:_GetFirstPersonLocalOffset(v28), v34);
	l__vehicleCameraCore__27:setTransform(v28);
	local v36 = CFrame.new(v28 * v35) * l__vehicleCameraCore__27:step(u1, v31, v30, v34) * v33;
	return v36 * CFrame.new(0, 0, v32), v36;
end;
function v11.ApplyVRTransform(p16)

end;
function v11.EnterFirstPerson(p17)
	p17.inFirstPerson = true;
	p17:UpdateMouseBehavior();
end;
function v11.LeaveFirstPerson(p18)
	p18.inFirstPerson = false;
	p18:UpdateMouseBehavior();
end;
return v11;
