disable reconsiliate rotate between camera & player if left mousse is pressed
This commit is contained in:
parent
824455501b
commit
de250310af
1 changed files with 29 additions and 24 deletions
|
@ -14,6 +14,7 @@ var max_angle = PI / 2
|
||||||
const TWO_PI = 2.0 * PI
|
const TWO_PI = 2.0 * PI
|
||||||
const PI_2 = PI / 2.0
|
const PI_2 = PI / 2.0
|
||||||
var debug:bool = false
|
var debug:bool = false
|
||||||
|
var reconciliate_rotate_camer_player:bool = true
|
||||||
|
|
||||||
|
|
||||||
func _init():
|
func _init():
|
||||||
|
@ -29,8 +30,10 @@ func _input(event):
|
||||||
# If right mouse button is pressed and mouse moves, pan horizontally camera
|
# If right mouse button is pressed and mouse moves, pan horizontally camera
|
||||||
# and rotate vertically
|
# and rotate vertically
|
||||||
if Input.is_action_just_pressed ( "ui_strafe" ):
|
if Input.is_action_just_pressed ( "ui_strafe" ):
|
||||||
|
reconciliate_rotate_camer_player = false
|
||||||
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
|
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
|
||||||
elif Input.is_action_just_released ( "ui_strafe" ):
|
elif Input.is_action_just_released ( "ui_strafe" ):
|
||||||
|
reconciliate_rotate_camer_player = true
|
||||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||||
if Input.is_action_just_released("ui_cut"):
|
if Input.is_action_just_released("ui_cut"):
|
||||||
print("debug on")
|
print("debug on")
|
||||||
|
@ -96,7 +99,9 @@ func _physics_process(delta):
|
||||||
|
|
||||||
func _process( delta ):
|
func _process( delta ):
|
||||||
if debug:
|
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
|
var diff = camera_rotate_y - player_rotate_y
|
||||||
|
|
||||||
if diff > PI:
|
if diff > PI:
|
||||||
|
|
Loading…
Reference in a new issue