Procházet zdrojové kódy

add cross method to Vector2

zhaoy před 7 roky
rodič
revize
ceef48eedc
1 změnil soubory, kde provedl 6 přidání a 0 odebrání
  1. 6 0
      src/math/Vector2.js

+ 6 - 0
src/math/Vector2.js

@@ -353,6 +353,12 @@ Object.assign( Vector2.prototype, {
 
 	},
 
+	cross: function ( v ) {
+
+		return this.x * v.y - this.y * v.x;
+
+	},
+
 	lengthSq: function () {
 
 		return this.x * this.x + this.y * this.y;