move scripts around
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
class_name MainCamera
|
||||
extends Camera3D
|
||||
|
||||
@export var _height_offset: float = 0.5
|
||||
@export var _distance: float = 50
|
||||
@export var _angle_degrees: Vector3 = Vector3(-35, -45, 0)
|
||||
@export var _aim_offset_factor: float = 0.2
|
||||
@export var _aim_damping: float = 1
|
||||
|
||||
var _floor_height: float = 0
|
||||
var _aim_offset: Vector3
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
Referencer.main_camera = self
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
_follow(delta)
|
||||
|
||||
|
||||
func _follow(delta: float) -> void:
|
||||
var player_position := Referencer.player.global_position
|
||||
if Referencer.player.is_on_floor():
|
||||
_floor_height = player_position.y
|
||||
player_position.y = _floor_height
|
||||
|
||||
if Inputer.mode == Inputer.Mode.KB_MOUSE:
|
||||
_aim_offset = Referencer.player.aim_offset
|
||||
else:
|
||||
var new_aim_offset := (
|
||||
Vector3.ZERO
|
||||
if Referencer.player.aim_input.length() == 0
|
||||
else Referencer.player.aim_offset
|
||||
)
|
||||
_aim_offset = _aim_offset.lerp(new_aim_offset, _aim_damping * delta)
|
||||
|
||||
var follow_position := player_position + _aim_offset * _aim_offset_factor
|
||||
|
||||
global_rotation_degrees = _angle_degrees
|
||||
global_position = (
|
||||
follow_position + Vector3.UP * _height_offset + transform.basis.z * _distance
|
||||
)
|
||||
|
||||
Debugger.circle("follow_position", follow_position)
|
||||
Reference in New Issue
Block a user