Explorar o código

add cross method to Vector2

zhaoy %!s(int64=7) %!d(string=hai) anos
pai
achega
ceef48eedc
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  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 () {
 	lengthSq: function () {
 
 
 		return this.x * this.x + this.y * this.y;
 		return this.x * this.x + this.y * this.y;