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

@@ -72,7 +72,6 @@ func _func_godot_apply_properties(entity_properties: Dictionary) -> void:
depth_position_offset = (Vector3.UP * (depth/2))
var outer_boudary = Geometry2D.convex_hull(verts_2d)
verts2d = outer_boudary

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)

View File

@@ -0,0 +1 @@
uid://18smkusl55no

6
demo/scenes/test.tscn Normal file
View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://bip0c3ydxx12r"]
[ext_resource type="Script" uid="uid://18smkusl55no" path="res://assets/scripts/test.gd" id="1_errlg"]
[node name="Test" type="Node"]
script = ExtResource("1_errlg")