Added Vector#lerp

This commit is contained in:
2019-10-01 11:48:22 -05:00
parent bb482f4463
commit 8f9e671340
2 changed files with 5 additions and 1 deletions

View File

@@ -162,6 +162,10 @@ module CyberarmEngine
@x + @y + @z
end
def lerp(other, factor)
(self - other) * factor.clamp(0.0, 1.0)
end
# 2D distance using X and Y
def distance(other)
Math.sqrt((@x-other.x)**2 + (@y-other.y)**2)