Creation of the RTree Godot Class
Basic defintions, we are going to see if it fits the use case.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
24
demo/assets/scripts/test.gd
Normal file
24
demo/assets/scripts/test.gd
Normal 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)
|
||||
1
demo/assets/scripts/test.gd.uid
Normal file
1
demo/assets/scripts/test.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://18smkusl55no
|
||||
Reference in New Issue
Block a user