Browse Source

Object3D: Clean up.

Mr.doob 2 năm trước cách đây
mục cha
commit
757dadf233
1 tập tin đã thay đổi với 8 bổ sung4 xóa
  1. 8 4
      src/core/Object3D.js

+ 8 - 4
src/core/Object3D.js

@@ -586,9 +586,11 @@ class Object3D extends EventDispatcher {
 
 
 		for ( let i = 0, l = children.length; i < l; i ++ ) {
 		for ( let i = 0, l = children.length; i < l; i ++ ) {
 
 
-			if ( children[ i ].matrixWorldAutoUpdate === true || force === true ) {
+			const child = children[ i ];
 
 
-				children[ i ].updateMatrixWorld( force );
+			if ( child.matrixWorldAutoUpdate === true || force === true ) {
+
+				child.updateMatrixWorld( force );
 
 
 			}
 			}
 
 
@@ -626,9 +628,11 @@ class Object3D extends EventDispatcher {
 
 
 			for ( let i = 0, l = children.length; i < l; i ++ ) {
 			for ( let i = 0, l = children.length; i < l; i ++ ) {
 
 
-				if ( children[ i ].matrixWorldAutoUpdate === true ) {
+				const child = children[ i ];
+
+				if ( child.matrixWorldAutoUpdate === true ) {
 
 
-					children[ i ].updateWorldMatrix( false, true );
+					child.updateWorldMatrix( false, true );
 
 
 				}
 				}