Fixerd camera
This commit is contained in:
parent
3df8247a84
commit
1d1929cd69
3 changed files with 4120 additions and 4 deletions
|
|
@ -8,7 +8,7 @@ class_name PlayerCamera
|
|||
var vertical_compensation : float
|
||||
var compensation_tween: Tween
|
||||
var compensate: bool = false
|
||||
var disable: bool = false
|
||||
var disabled: bool = false
|
||||
var compensation_speed: float
|
||||
@export var compensation_time: float = 1.0
|
||||
@export var compensation_delay: float = 0.5
|
||||
|
|
@ -21,7 +21,7 @@ func _ready() -> void:
|
|||
current = true
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if disable: return
|
||||
if disabled: return
|
||||
if compensate:
|
||||
if abs(vertical_compensation) <= 0.001:
|
||||
vertical_compensation = 0
|
||||
|
|
@ -30,7 +30,7 @@ func _process(delta: float) -> void:
|
|||
rotate_camera(0,compensation_speed * delta)
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if not is_multiplayer_authority() or disable:
|
||||
if not is_multiplayer_authority() or disabled:
|
||||
return
|
||||
if event is InputEventMouseMotion:
|
||||
rotate_camera(-event.relative.x * SENSITIVITY,-event.relative.y * SENSITIVITY)
|
||||
|
|
@ -57,3 +57,6 @@ func recoil(x,y) -> void:
|
|||
func start_compensating() -> void:
|
||||
compensate = true
|
||||
compensation_speed = vertical_compensation / compensation_time
|
||||
|
||||
func disable() -> void:
|
||||
disabled = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue