Add Center Function on Holes

Calculates the center of the hole.
This commit is contained in:
2025-11-24 20:03:52 -05:00
parent 703285f555
commit 0a3919ce4c
2 changed files with 14 additions and 6 deletions

View File

@@ -8,3 +8,11 @@ var vectors: PackedVector2Array
func _init(hole_id: int, vectors: PackedVector2Array):
self.hole_id = hole_id
self.vectors = vectors
func center():
var avg_vert = Vector2.ZERO
for v in vectors:
avg_vert += v
return avg_vert / len(vectors)