survivors: fixing homing projectiles behaving correctly after losing the target

This commit is contained in:
Sheldan
2025-08-30 19:30:49 +02:00
parent 39da3d8abd
commit e44355bf21
4 changed files with 10 additions and 6 deletions

View File

@@ -54,8 +54,12 @@ export class Vector {
return (this._x * vector._x + this._y * vector._y) / Math.pow(vector.vecLength(), 2);
}
dotProduct2(vector: Vector): number {
return (this._x * vector._x + this._y * vector._y)
}
angleTo(vector: Vector): number {
return Math.acos(this.dotProduct(vector))
return Math.acos(this.dotProduct2(vector) / (this.vecLength() * vector.vecLength()))
}
get x(): number {