Browse Source

Update negate to return a new Vector3

ApisNecros 4 months ago
parent
commit
ad13d63d54
1 changed files with 6 additions and 4 deletions
  1. 6 4
      12/Vector3.js

+ 6 - 4
12/Vector3.js

@@ -27,11 +27,13 @@ module.exports = class Vector3 {
     /**
      * Flip the sign of all properties of the vector
      *
-     * @returns {void}
+     * @returns {Vector3} A new Vector3
      */
     negate() {
-        this.x = -this.x;
-        this.y = -this.y;
-        this.z = -this.z;
+        return new Vector3(
+            -this.x,
+            -this.y,
+            -this.z,
+        );
     }
 };