disable reconsiliate rotate between camera & player if left mousse is pressed

This commit is contained in:
AleaJactaEst 2022-02-03 14:02:38 +01:00
parent 824455501b
commit de250310af

View file

@ -14,6 +14,7 @@ var max_angle = PI / 2
const TWO_PI = 2.0 * PI
const PI_2 = PI / 2.0
var debug:bool = false
var reconciliate_rotate_camer_player:bool = true
func _init():
@ -29,8 +30,10 @@ func _input(event):
# If right mouse button is pressed and mouse moves, pan horizontally camera
# and rotate vertically
if Input.is_action_just_pressed ( "ui_strafe" ):
reconciliate_rotate_camer_player = false
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
elif Input.is_action_just_released ( "ui_strafe" ):
reconciliate_rotate_camer_player = true
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
if Input.is_action_just_released("ui_cut"):
print("debug on")
@ -96,7 +99,9 @@ func _physics_process(delta):
func _process( delta ):
if debug:
print(camera_rotate_y,", ", player_rotate_y)
print(reconciliate_rotate_camer_player, ", ", camera_rotate_y,", ", player_rotate_y)
if reconciliate_rotate_camer_player:
var diff = camera_rotate_y - player_rotate_y
if diff > PI: