local g={}g.__index=g local T=require(script:WaitForChild("\083\109\111\111\116\104\068\097\109\112"))function g.new(X,E)assert(typeof(X)=="\086\101\099\116\111\114\051","\105\110\105\116\105\097\108\086\097\108\117\101 \115\104\111\117\108\100 \098\101 \086\101\099\116\111\114\051")assert(typeof(E)=="\110\117\109\098\101\114","\115\109\111\111\116\104\084\105\109\101 \115\104\111\117\108\100 \098\101 \097 \110\117\109\098\101\114")assert(E>=0,"\115\109\111\111\116\104\084\105\109\101 \109\117\115\116 \098\101 \097 \112\111\115\105\116\105\118\101 \110\117\109\098\101\114")local a=setmetatable({Value=X,Goal=X,SmoothTime=E},g)a._smoothDamp=T.new()return a end function g.Update(T,g)if g then T.Goal=g else g=T.Goal end local X=T._smoothDamp:Update(T.Value,g,T.SmoothTime)T.Value=X return X end function g.UpdateAngle(T,g)if g then T.Goal=g else g=T.Goal end local X=T._smoothDamp:UpdateAngle(T.Value,g,T.SmoothTime)T.Value=X return X end function g.SetMaxSpeed(T,g)T._smoothDamp.MaxSpeed=g end function g.GetMaxSpeed(g)return g._smoothDamp.MaxSpeed end return g
--[[
	
	This is a wrapper for the SmoothDamp module. It stores
	all needed variables internally for ease of use.
	
	-------------------------------------------------------------------------

	local smooth = Smooth.new(Vector3 initialValue, Number smoothTime)
	
	smooth.Value
	smooth.Goal
	smooth.SmoothTime
	
	smooth:Update([Vector goal])
	smooth:UpdateAngle([Vector goal])
	smooth:SetMaxSpeed(Number speed)
	smooth:GetMaxSpeed()

	-------------------------------------------------------------------------

	EXAMPLE:

		local smoothPosition = Smooth.new(part.Position, 0.5)

		runService:BindToRenderStep("Example", 0, function()
			local position = smoothPosition:Update(mouse.Hit.p)
			part.Position = position
		end)

--]]

local Smooth = {}
Smooth.__index = Smooth

local SmoothDamp = require(script:WaitForChild("SmoothDamp"))

function Smooth.new(initialValue, smoothTime)
	assert(typeof(initialValue) == "Vector3", "initialValue should be Vector3")
	assert(typeof(smoothTime) == "number", "smoothTime should be a number")
	assert(smoothTime >= 0, "smoothTime must be a positive number")

	local self = setmetatable({
		Value = initialValue,
		Goal = initialValue,
		SmoothTime = smoothTime,
	}, Smooth)

	self._smoothDamp = SmoothDamp.new()

	return self
end

function Smooth:Update(goal)
	if goal then
		self.Goal = goal
	else
		goal = self.Goal
	end
	local value = self._smoothDamp:Update(self.Value, goal, self.SmoothTime)
	self.Value = value
	return value
end

function Smooth:UpdateAngle(goal)
	if goal then
		self.Goal = goal
	else
		goal = self.Goal
	end
	local value = self._smoothDamp:UpdateAngle(self.Value, goal, self.SmoothTime)
	self.Value = value
	return value
end

function Smooth:SetMaxSpeed(speed)
	self._smoothDamp.MaxSpeed = speed
end

function Smooth:GetMaxSpeed()
	return self._smoothDamp.MaxSpeed
end

return Smooth
