diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-11-24 11:46:03 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-11-24 11:46:03 +0100 |
commit | b1d9bfe7e80b4d95acd26d0ab6a1ce34ad18d91c (patch) | |
tree | 3bc9cce0c176057fcc2f8b4640a3e23de374875e /free-look-camera.gd | |
parent | 1a785420ec47c78ac3f95bd0ece08c819653f6e8 (diff) |
Diffstat (limited to 'free-look-camera.gd')
-rw-r--r-- | free-look-camera.gd | 11 |
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) |