Browse Source

uses one instance of THREE.Matrix4 as proposed by @WestLangley in #1833

zz85 13 years ago
parent
commit
c7fc6afe41
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/core/Object3D.js

+ 3 - 3
src/core/Object3D.js

@@ -267,9 +267,7 @@ THREE.Object3D.prototype = {
 
 	worldToLocal: function ( vector ) {
 
-		if ( !this.__inverseMatrixWorld ) this.__inverseMatrixWorld = new THREE.Matrix4();
-
-		return this.__inverseMatrixWorld.getInverse( this.matrixWorld ).multiplyVector3( vector );
+		return THREE.Object3D.__m1.getInverse( this.matrixWorld ).multiplyVector3( vector );
 
 	},
 
@@ -281,4 +279,6 @@ THREE.Object3D.prototype = {
 
 };
 
+THREE.Object3D.__m1 = new THREE.Matrix4();
+
 THREE.Object3DCount = 0;