fix auto-attack targeting

This commit is contained in:
2025-01-13 11:45:26 +09:00
parent 49a4d3e924
commit 03bbea4862
8 changed files with 32 additions and 134 deletions
-12
View File
@@ -1,4 +1,3 @@
import QuickHull from 'quickhull' // DEPRECATED: hulls were a failed concept for position fixing
import SAT from 'sat'
import { Shape, ShapeUtils, Vector2 } from 'three'
@@ -26,7 +25,6 @@ export default class Terrain {
}
get colliders() { return this.#colliders }
get hull() { return this.#hull } // DEPRECATED: hulls were a failed concept for position fixing
get unadjustedWaypoints() { return this.#unadjustedWaypoints }
get vertices() { return this.#vertices }
@@ -76,16 +74,6 @@ export default class Terrain {
}
this.#colliders = ShapeUtils.triangulateShape(points.shape, points.holes).map(indicesToPolygon)
this.#calculateHull()
}
// DEPRECATED: hulls were a failed concept for position fixing
#calculateHull() {
const vertices = QuickHull(this.#vertices.map((v) => ({ x: v.x, y: v.y }))).map((v) => new Vector2(v.x, v.y))
const first = vertices.at(0)
const satPoints = [new SAT.Vector(...first.toArray()), ...vertices.slice(1).map((v) => new SAT.Vector(...v.clone(first).sub(first).toArray()))]
this.#hull = new SAT.Polygon(satPoints[0], [new SAT.Vector(), ...satPoints.slice(1)])
}
#calculatePosition() {