--


local Point = {}
Point.__index = Point

function Point.new(p)
	local self = setmetatable({}, Point)

	self.Position = p
	self.PreviousPosition = p
	self.Velocity = ZERO
	self.Acceleration = ZERO
	self.PreviousDt = nil
	
	self.Anchored = false

	return self
end

function Point:Step(dt, damping)
	self.PreviousDt = self.PreviousDt or dt

	if (not self.Anchored) then
		self.Acceleration = Vector3.new(0, -game.Workspace.Gravity, 0)
		self.Velocity = self.Position - self.PreviousPosition
		self.PreviousPosition = self.Position
		
		self.Position = self.Position + self.Velocity*(dt/self.PreviousDt)*damping + self.Acceleration*dt*dt
	else
		self.Acceleration = ZERO
		self.Velocity = ZERO
		self.PreviousPosition = self.Position
	end
	
	self.PreviousDt = dt
end
