[SOLVED] Fix Light position regardless of user controls

evening all

If someone could help me with this issue I would be forever grateful

I need to fix the position of the PointLight so that it remains in the same place, regardless of rotation or user input (i.e orbit controls)

I’ve been playing around a googling for ruddy ages! hit a dead end…

Any thoughts?!

Cheers

If I understood you correctly, then as an option, you can use an instance of THREE.Group() as a holder for the point light and copy camera’s quaternion into its quaternion in the animation loop.

https://jsfiddle.net/prisoner849/xnh9pyd0/

var pointLight = new THREE.PointLight(0xffffff, 10, 40);
pointLight.position.set(50, 50, 76);
var lightHolder = new THREE.Group();
lightHolder.add(pointLight);
scene.add(lightHolder);
...
lightHolder.quaternion.copy(camera.quaternion); // in the animation loop

LightHolder

4 Likes

Perfect… That’s exactly what I’m after. Many thanks

Another option that should work is to add the light to the camera and add the camera to the scene:

camera.add( light )
scene.add( camera )
2 Likes

That approach works fine without zooming in/out.
But with zooming it gives undesirable effect:
https://jsfiddle.net/prisoner849/8bzyjgty/
CameraLight
as the light source moves with the camera.