summaryrefslogtreecommitdiff
path: root/free-look-camera.gd
diff options
context:
space:
mode:
Diffstat (limited to 'free-look-camera.gd')
-rw-r--r--free-look-camera.gd11
1 files changed, 11 insertions, 0 deletions
diff --git a/free-look-camera.gd b/free-look-camera.gd
index e35485f..50c2311 100644
--- a/free-look-camera.gd
+++ b/free-look-camera.gd
@@ -30,6 +30,14 @@ var _shift = false
var _alt = false
func _input(event):
+ if not current:
+ return
+
+ if event is InputEventMouse and event.is_pressed():
+ Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
+ if event.is_action_pressed("mouse_exit"):
+ Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
+
# Receives mouse motion
if event is InputEventMouseMotion:
_mouse_position = event.relative
@@ -66,6 +74,9 @@ func _input(event):
# Updates mouselook and movement every frame
func _process(delta):
+ if not current:
+ return
+
_update_mouselook()
_update_movement(delta)