I set its direction below, but it not works. The light.shadow.camera always lookAt (0,0,0)
var light = new THREE.DirectionalLight(0xffffff, 1)
light.position.set(20,0,20)
light.lookAt(new THREE.Vector3(400,400,400))
light.castShadow = true
here is my code on codepen:
[codepen] (https://codepen.io/iamnotstone/pen/jzrzge)
sorry for this question. I solved myself.
I should using light.target to set the light’s direction.As the documentation said:
The DirectionalLight points from its position to target.position. The default position of the target is (0, 0, 0). Note: For the target’s position to be changed to anything other than the default, it must be added to the scene using
3 Likes