I've set up a scene in Three.js with OrbitControls.js to allow for rotation and panning. I would like my lighting set-up to follow the camera, ensuring that the object in the scene is always illuminated. (Right now you can rotate to the "dark side" of the object).
I've tried to solve this problem by making each light a child of the camera:
scene.add(light);
camera.add(light);
However, this produce the desired effect. The only other way I can think of solving this problem is by keeping track of the camera's change in spherical coordinates and making the lights match those changes (but this is undesirable for a myriad of reasons).
I'm relatively new to Three.js so I'm hoping there is an easy solution that I'm just unfamiliar with. Thanks!
PointLight. See ifscene.add( camera ); camera.add( light );is sufficient for your needs. three.js r.67PointLight, and it still isn't moving with the camera despite being listed (in DevTools) as a child of the Camera. Here's my function for adding lights to the scene:function createLight(color, intensity, position) { var light = new THREE.PointLight(color, intensity); light.position = position; light.distance = 0; scene.add(light); camera.add(light);(Sorry for formatting issues, not sure how to make it display properly)scene.add( camera ); camera.add( light );.