From 8743685a9556f13dbfdb7028f885ab844ce3b891 Mon Sep 17 00:00:00 2001 From: 06wj <06wj@163.com> Date: Wed, 7 Jun 2017 20:44:33 +0800 Subject: [PATCH] Optimize Ray.applyMatrix4 performance --- src/math/Ray.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/math/Ray.js b/src/math/Ray.js index 988465c777c72c..068704f5f96058 100644 --- a/src/math/Ray.js +++ b/src/math/Ray.js @@ -515,10 +515,8 @@ Object.assign( Ray.prototype, { applyMatrix4: function ( matrix4 ) { - this.direction.add( this.origin ).applyMatrix4( matrix4 ); this.origin.applyMatrix4( matrix4 ); - this.direction.sub( this.origin ); - this.direction.normalize(); + this.direction.transformDirection( matrix4 ); return this;