create StaticNodeManager to hold all the nodes that need to get accessed globally
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user