I want the directional lights in my scene to follow the camera as the user moves it.
The lights are added to a parent THREE.Group which is added to the scene.
As part of the animation loop, I copy the quaternion from the camera to the light parent and I thought this would give me what I want but as you can see from the fiddle, it does not.
The directionalLight also has a .target member which is an Object3d that the light will point at… (which isn’t added to the scene by default) so if you want to attach the directionalLight to something moving, you also want to:
Cameras always point along the z axis… but a directionalLight points towards the light.target.position. So they don’t really behave the same.
Also… you might want to check the semantics of DirectionalLightHelper… Im not sure if its supposed to be added to the parent as well, or if its just supposed to be in the scene, and .update() called on it?
That might be muddying the waters…
I don’t like finding posts without updated Fiddles after a solution is found so I updated mine with what I think is the answer.
I also added an EXR environment map to the scene (and background, for debugging purposes) and made the model shinier so I could see the effects more readily. I update the rotation of the environment and background from the camera in the same way as the light helpers. (Thanks three.js #162)