- linearly interpolate means to “change” doesn’t it?
- I thought LERPing was a way of getting a number to change smoothly over a set amount of time, and works better than changing the number every update because you don’t know how often an update is going to happen. But that would just be animating wouldn’t it? So what is lerping?
function init(self)
self.t = 0
end
function update(self, dt)
self.t = self.t + dt
if self.t <= 1 then
local startpos = vmath.vector3(0, 600, 0)
local endpos = vmath.vector3(600, 0, 0)
local pos = vmath.lerp(self.t, startpos, endpos)
go.set_position(pos, "go")
end
end
In this code, i understand that startpos and endpos are where you want the lerp to start and finish. But what is self.t?