Add Center Function on Holes
Calculates the center of the hole.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user