From 028d7e13ca1ec65ce2ea018008711f13e27241c7 Mon Sep 17 00:00:00 2001 From: xLuxy <67131061+xLuxy@users.noreply.github.com> Date: Sat, 15 Jun 2024 07:52:18 +0200 Subject: [PATCH] fix(shared): Add missing Vector.toArray method --- shared/js/classes/vector.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/shared/js/classes/vector.js b/shared/js/classes/vector.js index 557274c62..88f925e80 100644 --- a/shared/js/classes/vector.js +++ b/shared/js/classes/vector.js @@ -91,6 +91,10 @@ export class Vector3 { return dx * dx + dy * dy + dz * dz; } + toArray() { + return [this.x, this.y, this.z]; + } + toFixed(precision = 4) { return new Vector3(parseFloat(this.x.toFixed(precision)), parseFloat(this.y.toFixed(precision)), parseFloat(this.z.toFixed(precision))); } @@ -230,6 +234,10 @@ export class Vector2 { return dx * dx + dy * dy; } + toArray() { + return [this.x, this.y]; + } + toFixed(precision = 4) { return new Vector2(parseFloat(this.x.toFixed(precision)), parseFloat(this.y.toFixed(precision))); }