Reputation: 1768
The DirectionalLightShadow always lookAt Vector3(0,0,0).
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:
https://codepen.io/iamnotstone/pen/jzrzge
Upvotes: 0
Views: 111
Reputation: 1768
I found that I have to use the light.target to specify the direction.
see the documentation
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
Upvotes: 1