I need to sync trackball controls and camera with the directional light.
My case scenario: Init an empty scene with camera, lights and controls. Load a bufferGeometry obj, get its centroid and set camera and controls position and target relative to the obj centroid. Basically I simply set camera position and controls.target with:
camera.lookAt( position );
camera.position = position;
controls.target.copy( position );
where position is a Three.Vector3 obj.
Directional light has to sync automatically with controls.
I did it using threejs r66:
function init(){
...
directionalLight.position = controls.object.position;
directionalLight.target.position = controls.target;
...
}
where controls is a THREE.TrackballControls object.
With threejs r69 does not work anymore. Any suggestions?
Thanks,
Simone
Solved using a pointLight instead a directionalLight.
var pointLight = new THREE.PointLight( 0xffffff, 1, 100 ); camera.add( pointLight );
Thanks all for the help