Skip to content

Commit

Permalink
Make sure to keep follow lerp within 0 and 1
Browse files Browse the repository at this point in the history
Fixes #51
  • Loading branch information
britzl committed Mar 31, 2022
1 parent 08115a9 commit fb01580
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion orthographic/camera.script
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,13 @@ function on_message(self, message_id, message, sender)
self.follow = true
if message.horizontal == nil then message.horizontal = true end
if message.vertical == nil then message.vertical = true end
local lerp = message.lerp or 1
if lerp < 0 then lerp = 0 end
if lerp > 1 then lerp = 1 end
self.follow_horizontal = message.horizontal
self.follow_vertical = message.vertical
self.follow_target = type(message.target) == "string" and hash(message.target) or message.target
self.follow_lerp = message.lerp or 1
self.follow_lerp = lerp
self.follow_offset = message.offset or vmath.vector3()
self.follow_immediately = message.immediate
if self.follow and self.follow_immediately then
Expand Down

0 comments on commit fb01580

Please sign in to comment.