ソースを参照

Added subtractInPlace to Vector2

Yannick Comte 11 年 前
コミット
d04066d0ad
2 ファイル変更10 行追加0 行削除
  1. 5 0
      Babylon/Math/babylon.math.js
  2. 5 0
      Babylon/Math/babylon.math.ts

+ 5 - 0
Babylon/Math/babylon.math.js

@@ -292,6 +292,11 @@
         Vector2.prototype.subtract = function (otherVector) {
             return new Vector2(this.x - otherVector.x, this.y - otherVector.y);
         };
+		
+		Vector2.prototype.subtractInPlace = function (otherVector) {
+            this.x -= otherVector.x;
+            this.y -= otherVector.y;
+        };
 
         Vector2.prototype.multiplyInPlace = function (otherVector) {
             this.x *= otherVector.x;

+ 5 - 0
Babylon/Math/babylon.math.ts

@@ -258,6 +258,11 @@
         public subtract(otherVector: Vector2): Vector2 {
             return new Vector2(this.x - otherVector.x, this.y - otherVector.y);
         }
+		
+		public subtractInPlace(otherVector: Vector2): void {
+            this.x -= otherVector.x;
+            this.y -= otherVector.y;
+        }
 
         public multiplyInPlace(otherVector: Vector2): void {
             this.x *= otherVector.x;