From e14136cf9051b4c09dab91396a5633a1d42d4ea1 Mon Sep 17 00:00:00 2001 From: stirante Date: Mon, 13 Jan 2025 09:10:44 +0100 Subject: [PATCH] BREAKING: Fix direction vector assignments for North and South --- src/Vec3.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Vec3.ts b/src/Vec3.ts index 1744f4a..fb07ea6 100644 --- a/src/Vec3.ts +++ b/src/Vec3.ts @@ -33,11 +33,11 @@ export default class Vec3 implements Vector3 { } else if (x === Direction.North) { this.x = 0; this.y = 0; - this.z = 1; + this.z = -1; } else if (x === Direction.South) { this.x = 0; this.y = 0; - this.z = -1; + this.z = 1; } else if (x === Direction.East) { this.x = 1; this.y = 0; @@ -708,8 +708,8 @@ export default class Vec3 implements Vector3 { if (maxValue === -normalized.x) return Direction.West; if (maxValue === normalized.y) return Direction.Up; if (maxValue === -normalized.y) return Direction.Down; - if (maxValue === normalized.z) return Direction.North; - if (maxValue === -normalized.z) return Direction.South; + if (maxValue === normalized.z) return Direction.South; + if (maxValue === -normalized.z) return Direction.North; // This should never happen Vec3.log.error(new Error("Cannot convert vector to direction"), this); throw new Error("Cannot convert vector to direction");