correct issue on strafe action

This commit is contained in:
AleaJactaEst 2022-02-03 14:16:48 +01:00
parent de250310af
commit 09c4476938

View file

@ -71,11 +71,14 @@ func _physics_process(delta):
# Get the input direction and handle the movement/deceleration.
if Input.is_action_pressed("ui_strafe"):
input_dir = Input.get_vector("ui_right", "ui_left", "ui_down", "ui_up")
else: # if not Input.is_action_pressed( "ui_strafe" ):
else:
var y = 0
if Input.is_action_pressed("ui_right") and not Input.is_action_pressed("ui_strafe_right"):
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") and not Input.is_action_pressed("ui_strafe_left"):
if Input.is_action_pressed("ui_left"):
y += 1
if y != 0:
var dt = y * delta * speed_rotate_1sec
@ -85,7 +88,7 @@ func _physics_process(delta):
elif camera_rotate_y <= -PI:
camera_rotate_y += TWO_PI
$camera_root/horizontal_root.rotate_y( dt )
input_dir = Input.get_vector("ui_strafe_right", "ui_strafe_left", "ui_down", "ui_up")
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:
@ -97,6 +100,7 @@ func _physics_process(delta):
move_and_slide()
func _process( delta ):
if debug:
print(reconciliate_rotate_camer_player, ", ", camera_rotate_y,", ", player_rotate_y)