From 79ecdc822b3503731848b5322a6ddc4765438714 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Mon, 29 Apr 2019 08:45:48 +0200 Subject: [PATCH] modules/world: only attach view to camera if one is requested --- gamecore/modules/world/camera.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gamecore/modules/world/camera.lua b/gamecore/modules/world/camera.lua index d70057c..3df293b 100644 --- a/gamecore/modules/world/camera.lua +++ b/gamecore/modules/world/camera.lua @@ -83,15 +83,19 @@ function CameraSystem:getViewCam(id) end function CameraSystem:attachView(id) - local cam = self:getViewCam(id) + if (id ~= nil) then + local cam = self:getViewCam(id) - cam:attach() + cam:attach() + end end function CameraSystem:detachView(id) - local cam = self:getViewCam(id) + if (id ~= nil) then + local cam = self:getViewCam(id) - cam:detach() + cam:detach() + end end return CameraSystem