-
Notifications
You must be signed in to change notification settings - Fork 226
Open
Description
ros3djs/src/visualization/Viewer.js
Line 131 in 530f7ec
| //this.directionalLight.position = this.camera.localToWorld(new THREE.Vector3(-1, 1, 0)); |
This is how:
this.directionalLight.position.copy(this.camera.localToWorld(new THREE.Vector3(-1, 1, 0)));But there is a much easier way that makes more sense: make the directional light a child of the camera, and make sure the camera is added to the scene. So removing that from the draw() method, we would instead replace the this in the constructor,
this.scene.add(this.directionalLight);with this,
this.scene.add(this.camera);
this.camera.add(this.directionalLight);. Now the light will move wherever the camera goes, without having to do any procedure to sync one matrix to the other.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels