소스 검색

Lights with a target will have their target automatically added to the scene to honor matrixAutoUpdate.

Erik Kitson 13 년 전
부모
커밋
39dadf18f4
2개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 0 1
      examples/webgl_materials_cubemap_dynamic.html
  2. 6 0
      src/scenes/Scene.js

+ 0 - 1
examples/webgl_materials_cubemap_dynamic.html

@@ -178,7 +178,6 @@
 				spotLight.shadowMapHeight = SHADOW_MAP_HEIGHT;
 
 				scene.add( spotLight );
-				scene.add( spotLight.target );
 
 				directionalLight2 = new THREE.PointLight( 0xff9900, 0.25 );
 				directionalLight2.position.set( 0.5, -1, 0.5 );

+ 6 - 0
src/scenes/Scene.js

@@ -32,6 +32,12 @@ THREE.Scene.prototype.addObject = function ( object ) {
 
 		}
 
+		if ( object.target && object.target.parent === undefined ) {
+
+			this.add( object.target );
+
+		}
+
 	} else if ( !( object instanceof THREE.Camera || object instanceof THREE.Bone ) ) {
 
 		if ( this.__objects.indexOf( object ) === - 1 ) {