Skip to content

Commit efc00c2

Browse files
committed
Only apply directional input when viewport is focused
1 parent e55a404 commit efc00c2

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/nodes/player_node.nim

+3-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import
77
input_event_screen_drag, input_event_screen_touch,
88
input_event_joypad_motion, ray_cast, scene_tree, input_event_pan_gesture,
99
viewport, camera, global_constants, collision_shape, kinematic_collision,
10-
packed_scene, resource_loader
10+
packed_scene, resource_loader,
1111
]
1212
import core, gdutils, nodes/helpers
1313
import aim_target, models
@@ -214,8 +214,7 @@ gdobj PlayerNode of KinematicBody:
214214

215215
const forward_rotation = deg_to_rad(-90.0)
216216
let
217-
process_input =
218-
EditorVisible notin state.local_flags or CommandMode in state.local_flags
217+
process_input = ViewportFocused in state.local_flags
219218
input_direction =
220219
if process_input:
221220
self.get_input_direction()
@@ -259,8 +258,7 @@ gdobj PlayerNode of KinematicBody:
259258
if self.down_ray.is_colliding():
260259
let length = 1.85
261260
let diff =
262-
length -
263-
(
261+
length - (
264262
self.down_ray.global_transform.origin -
265263
self.down_ray.get_collision_point
266264
).y

0 commit comments

Comments
 (0)