I'm trying to attach a directional flashlight to the camera (controls object) so the beam is always where center of the screen is aiming at. This is my code:
controls = new PointerLockControls( camera, document.body );
var flashlight = new THREE.SpotLight(0xffffff, 7, 50, 0.8*Math.PI);
controls.getObject().add(flashlight);
controls.getObject().add(flashlight.target);
but the result is the light around camera, not a straight beam. (see pic below)
so how can I achieve a directional beam?
//edit, added Group.
controls = new PointerLockControls( camera, document.body );
var flashlight = new THREE.SpotLight(0xffffff, 7, 50, 0.8*Math.PI);
// camera.add(flashlight);
// camera.add(flashlight.target);
const group = new THREE.Group();
group.add(camera);
group.add(flashlight);
scene.add(group);
