'get_veiwport' nonexistent function in base 'Node' Error

Godot 4 most recent version

I am new and don’t know what wrong I keep getting nonexistent function ‘get_veiwport’ in base ‘Node’

Heres my Code

extends Area2D

@onready var camera = $Camera2D

@onready var veiwpoint = get_tree().root.get_child(0).get_veiwport()

func _on_body_entered(body: Node) -> void:
	var character_position = body.global_position
	var camera_limits = Rect2(camera.limit_left, camera.limit_top, camera.limit_right - camera.limit_left,
	camera.limit_bottom - camera.limit_top)
	
	print("Body Entered")
	print("Character Global Position:", character_position)
	
	if not camera_limits.has_point(character_position):
		print("Chracter Out of View Switching Scenes")
		get_tree().change_scene_to_file("res://death_s.tscn")

switch the i and e. get_viewport

1 Like

Thanks. Guess I didn’t notice after working on it for 4 hours

1 Like