Creation of the RTree Godot Class

Basic defintions, we are going to see if it fits the use case.
This commit is contained in:
2025-11-21 13:55:37 -05:00
parent b7891f58da
commit 36c648cfe5
11 changed files with 130 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
extends Node
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
var rtree = RectangleTree.new()
var min1 = Vector2(0, 0)
var max1 = Vector2(1, 1)
var min2 = Vector2(0, 0)
var max2 = Vector2(0.5, 0.5)
rtree.add(min1, max1, 0)
rtree.add(min2, max2, 1)
var result = rtree.query(Vector2(0.25, 0.25))
print(result)
rtree.remove(0)
result = rtree.query(Vector2(0.25, 0.25))
print(result)