disable strafe with only keyboard
This commit is contained in:
parent
09c4476938
commit
4608af0f80
2 changed files with 18 additions and 26 deletions
|
@ -73,22 +73,19 @@ func _physics_process(delta):
|
|||
input_dir = Input.get_vector("ui_right", "ui_left", "ui_down", "ui_up")
|
||||
else:
|
||||
var y = 0
|
||||
if Input.is_action_pressed("ui_strafe_right") or Input.is_action_pressed("ui_strafe_left"):
|
||||
input_dir = Input.get_vector("ui_strafe_right", "ui_strafe_left", "ui_down", "ui_up")
|
||||
else:
|
||||
if Input.is_action_pressed("ui_right"):
|
||||
y -= 1
|
||||
if Input.is_action_pressed("ui_left"):
|
||||
y += 1
|
||||
if y != 0:
|
||||
var dt = y * delta * speed_rotate_1sec
|
||||
camera_rotate_y += dt
|
||||
if camera_rotate_y > PI:
|
||||
camera_rotate_y -= TWO_PI
|
||||
elif camera_rotate_y <= -PI:
|
||||
camera_rotate_y += TWO_PI
|
||||
$camera_root/horizontal_root.rotate_y( dt )
|
||||
input_dir = Input.get_vector("nothing", "nothing", "ui_down", "ui_up")
|
||||
if Input.is_action_pressed("ui_right"):
|
||||
y -= 1
|
||||
if Input.is_action_pressed("ui_left"):
|
||||
y += 1
|
||||
if y != 0:
|
||||
var dt = y * delta * speed_rotate_1sec
|
||||
camera_rotate_y += dt
|
||||
if camera_rotate_y > PI:
|
||||
camera_rotate_y -= TWO_PI
|
||||
elif camera_rotate_y <= -PI:
|
||||
camera_rotate_y += TWO_PI
|
||||
$camera_root/horizontal_root.rotate_y( dt )
|
||||
input_dir = Input.get_vector("nothing", "nothing", "ui_down", "ui_up")
|
||||
|
||||
var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
||||
if direction:
|
||||
|
|
|
@ -45,18 +45,13 @@ ui_down={
|
|||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_strafe_left={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":true,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_strafe_right={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":true,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_strafe={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"pressed":false,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_run={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":0,"physical_keycode":16777237,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue