Explorar o código

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

zz85 %!s(int64=13) %!d(string=hai) anos
pai
achega
c7fc6afe41
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  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;