From 8578b58bd820f4194e15c5de3245585e3852883e Mon Sep 17 00:00:00 2001
From: paulmasson
-// White directional light at half intensity shining from the top.
-var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 );
-scene.add( directionalLight );
-
+ // White directional light at half intensity shining from the top.
+ var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 );
+ scene.add( directionalLight );
+
- scene.add( light.target );
-
-
+
+
+ scene.add( light.target );
+
+
This is so that the target's [page:Object3D.matrixWorld matrixWorld] gets automatically
updated each frame.
It is also possible to set the target to be another object in the scene (anything with a
[page:Object3D.position position] property), like so:
-
- var targetObject = new THREE.Object3D();
- scene.add(targetObject);
+
+ var targetObject = new THREE.Object3D();
+ scene.add(targetObject);
- light.target = targetObject;
-
+ light.target = targetObject;
+
+ The directionalLight will now track the target object.
-