网格寻路 NavMesh 实现

This commit is contained in:
kercylan98
2023-06-19 20:17:40 +08:00
parent 61cf79d172
commit 686ab9de3a
3 changed files with 120 additions and 2 deletions
+3 -1
View File
@@ -5,8 +5,9 @@ import (
"github.com/kercylan98/minotaur/utils/geometry"
)
func newShape[V generic.SignedNumber](s geometry.Shape[V]) *shape[V] {
func newShape[V generic.SignedNumber](id int, s geometry.Shape[V]) *shape[V] {
return &shape[V]{
id: id,
Shape: s,
centroid: geometry.CalcRectangleCentroid(s),
boundingRadius: geometry.CalcBoundingRadius(s),
@@ -15,6 +16,7 @@ func newShape[V generic.SignedNumber](s geometry.Shape[V]) *shape[V] {
}
type shape[V generic.SignedNumber] struct {
id int
geometry.Shape[V]
links []*shape[V]
portals []geometry.Line[V]