diff --git a/src/game-lib-vector-3.js b/src/game-lib-vector-3.js index d6396e7..6b5d802 100644 --- a/src/game-lib-vector-3.js +++ b/src/game-lib-vector-3.js @@ -12,6 +12,14 @@ GameLib.D3.Vector3.prototype.subtract = function (v) { ); }; +GameLib.D3.Vector3.prototype.sub = function (v) { + return new GameLib.D3.Vector3( + this.x - v.x, + this.y - v.y, + this.z - v.z + ); +}; + GameLib.D3.Vector3.prototype.cross = function (v) { return new GameLib.D3.Vector3( this.y * v.z - this.z * v.y, @@ -137,7 +145,7 @@ GameLib.D3.Vector3.prototype.multiply = function (s) { z ); - } else if(isNumber(s)) { + } else if(!isNaN(parseFloat(s)) && isFinite(s)) { return new GameLib.D3.Vector3( this.x * s,