Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
187
rated 0 times [  189] [ 2]  / answers: 1 / hits: 7883  / 10 Years ago, wed, july 16, 2014, 12:00:00

I having a problem with Three.js and lighting following a camera.



I am using orbit control for the mouse movement/



In release number 66 the following use to work



    light = new THREE.DirectionalLight( 0xffffff, 1 );
light.position = camera.position;
scene.add(light);


However in release number 67 and 68 the lighting doesn't follow the camera. The light is only show on one face.


More From » three.js

 Answers
2

Some of the Object3D properties have become immutable in r68, so copying to .position directly won't work anymore. Instead you need to use the various methods on these properties:



light.position.copy( camera.position );


I've not used these lights myself, but from the documentation I gather that they aren't supposed to automatically follow anything. Also, the position is irrelevant since they act like they're an infinite distance away; only the rotation matters.


[#43825] Wednesday, July 16, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
elmer

Total Points: 432
Total Questions: 96
Total Answers: 107

Location: Jordan
Member since Wed, Jun 17, 2020
4 Years ago
;