Skip to content

Commit

Permalink
Handle dt == 0 when lerping
Browse files Browse the repository at this point in the history
  • Loading branch information
britzl committed Oct 26, 2020
1 parent 9d12208 commit d660e0f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions orthographic/camera.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ end
-- return vmath.lerp(1 - math.pow(t, dt), v1, v2)
-- https://www.gamasutra.com/blogs/ScottLembcke/20180404/316046/Improved_Lerp_Smoothing.php
local function lerp_with_dt(t, dt, v1, v2)
if dt == 0 then return vmath.lerp(t, v1, v2) end
local rate = UPDATE_FREQUENCY * math.log10(1 - t)
return vmath.lerp(1 - math.pow(10, rate * dt), v1, v2)
--return vmath.lerp(t, v1, v2)
Expand Down

0 comments on commit d660e0f

Please sign in to comment.