Skip to content

Commit

Permalink
BREAKING: Fix direction vector assignments for North and South
Browse files Browse the repository at this point in the history
  • Loading branch information
stirante committed Jan 13, 2025
1 parent a738e7b commit e14136c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Vec3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit e14136c

Please sign in to comment.