I've been creating a spring and when I call it, it keeps telling me it expects a vector3 which doesn't make any sense. Any help would be nice. It shouldn't need a Vector3 for it
local spring = {}
function spring.new(position,velocity,target)
local self = setmetatable({},{__index = spring})
self.position = position
self.velocity = velocity
self.target = target
self.k = 1
self.friction = 1
return self
end
function spring:update()
local d = (self.target-self.position) -- Error here
local f = d*self.k
self.velocity = (self.velocity * (1-self.friction)) + f
self.position = self.position + self.velocity
end
return spring

1 comment
I'm trying to pass through numbers, not a Vector3