function CameraModifier.Destroy(j)j.CameraClass.Update=j.DefaultCamUpdate j.PopperClass.Update=j.DefaultPopUpdate j.BaseClass.UpdateMouseBehavior=j.DefaultMouseBehavior end function CameraModifier.OnCameraUpdate(a,j,f)workspace.CurrentCamera.CFrame=a.LastCFrame workspace.CurrentCamera.Focus=a.LastFocus return a.DefaultCamUpdate(j,f)end function CameraModifier.OnPopperUpdate(X,j,f,a,m)local x,U if X.WallStick.CameraMode=="\067\117\115\116\111\109"then local x,U=X.WallStick.HRP.CFrame,X.WallStick.PhysicsHRP.CFrame local g=x:ToWorldSpace(U:ToObjectSpace(a))local J=x:ToWorldSpace(U:ToObjectSpace(m))g,J=X.DefaultPopUpdate(j,f,g,J)X.LastCFrame=U:ToWorldSpace(x:ToObjectSpace(g))X.LastFocus=U:ToWorldSpace(x:ToObjectSpace(J))return g,J else local x,U=X.DefaultPopUpdate(j,f,a,m)X.LastCFrame=x X.LastFocus=U return x,U end end
-- Public methods

function CameraModifier:Destroy()
	self.CameraClass.Update = self.DefaultCamUpdate
	self.PopperClass.Update = self.DefaultPopUpdate
	self.BaseClass.UpdateMouseBehavior = self.DefaultMouseBehavior
end

function CameraModifier:OnCameraUpdate(this, dt)
	workspace.CurrentCamera.CFrame = self.LastCFrame
	workspace.CurrentCamera.Focus = self.LastFocus
	return self.DefaultCamUpdate(this, dt)
end

function CameraModifier:OnPopperUpdate(this, dt, dCamCF, dCamFocus)
	local camCF, focusCF
	if self.WallStick.CameraMode == "Custom" then
		-- dCamCF and dCamFocus are in physics space
		local hrpCF, phrpCF = self.WallStick.HRP.CFrame, self.WallStick.PhysicsHRP.CFrame

		local camCF = hrpCF:ToWorldSpace(phrpCF:ToObjectSpace(dCamCF))
		local focusCF = hrpCF:ToWorldSpace(phrpCF:ToObjectSpace(dCamFocus))

		camCF, focusCF = self.DefaultPopUpdate(this, dt, camCF, focusCF) -- real space

		self.LastCFrame = phrpCF:ToWorldSpace(hrpCF:ToObjectSpace(camCF))
		self.LastFocus = phrpCF:ToWorldSpace(hrpCF:ToObjectSpace(focusCF))

		return camCF, focusCF
	else
		-- if mode is Default or Debug we do nothing special since the camera subject is where it needs to be
		local camCF, focusCF = self.DefaultPopUpdate(this, dt, dCamCF, dCamFocus)

		self.LastCFrame = camCF
		self.LastFocus = focusCF

		return camCF, focusCF
	end
end
