Skip to content

Commit fb01580

Browse files
committed
Make sure to keep follow lerp within 0 and 1
Fixes #51
1 parent 08115a9 commit fb01580

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

orthographic/camera.script

+4-1
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,13 @@ function on_message(self, message_id, message, sender)
8888
self.follow = true
8989
if message.horizontal == nil then message.horizontal = true end
9090
if message.vertical == nil then message.vertical = true end
91+
local lerp = message.lerp or 1
92+
if lerp < 0 then lerp = 0 end
93+
if lerp > 1 then lerp = 1 end
9194
self.follow_horizontal = message.horizontal
9295
self.follow_vertical = message.vertical
9396
self.follow_target = type(message.target) == "string" and hash(message.target) or message.target
94-
self.follow_lerp = message.lerp or 1
97+
self.follow_lerp = lerp
9598
self.follow_offset = message.offset or vmath.vector3()
9699
self.follow_immediately = message.immediate
97100
if self.follow and self.follow_immediately then

0 commit comments

Comments
 (0)