create StaticNodeManager to hold all the nodes that need to get accessed globally

This commit is contained in:
2024-10-13 15:17:31 +10:00
parent be13b9dbfb
commit a9aed09bfa
15 changed files with 56 additions and 48 deletions

View File

@@ -5,18 +5,14 @@ const EDGE_MARGIN = 10
var target: Node3D
@onready var camera: Camera3D = get_viewport().get_camera_3d()
func _ready() -> void:
assert(camera != null, "camera missing!")
super._ready()
func _process(_delta: float) -> void:
if not visible or target == null:
return
var pos := camera.unproject_position(target.global_position)
var pos := StaticNodesManager.main_camera.unproject_position(
target.global_position
)
var corner_1 := Vector2.ONE * EDGE_MARGIN
var viewport_size := get_viewport().get_visible_rect().size
var corner_2 := Vector2(