Browse Source

Add negate function to Vector3

ApisNecros 4 months ago
parent
commit
befb2d7123
1 changed files with 11 additions and 0 deletions
  1. 11 0
      12/Vector3.js

+ 11 - 0
12/Vector3.js

@@ -23,4 +23,15 @@ module.exports = class Vector3 {
         this.y += operand.y;
         this.z += operand.z;
     }
+
+    /**
+     * Flip the sign of all properties of the vector
+     *
+     * @returns {void}
+     */
+    negate() {
+        this.x = -this.x;
+        this.y = -this.y;
+        this.z = -this.z;
+    }
 };