I would like to be able to change the rotation of spotlights in the threejs editor. Currently I’m setting up the lighting of my scene with code but it’s a bit of a hassle. Furthermore I would like to offset the work of lighting to the scene to some of our artists.
I’d like to contribute to this project and I could probably do a pull request, but before I do I would like find out if there maybe already is a way to easily rotate spotlights in the editor. That way I’m not implementing something unnecessary.
Does anyone know if there’s an easy way to do this already?
Rotating a spotlight or directional light has no effect. These lights shine from their position towards the
light.target, which by default is at (0,0,0). To adjust the position of the target you need to set the target’s position, and add it to the scene.
Alternatively, you can use another object in the scene if you just need the light to shine onto something.
Looking at the editor interface now, I don’t think there’s any way to set the position of the light’s target, unless I’m missing something.
Cool, thanks for the info! I’ll try to implement this then. I was thinking of adding a button to the sidebar to create an object and set it as target of the light. Being able to rotate lights using rotation controls would be nice but I’m not sure how easy that’s going to be.
I’m also not sure how importing and exporting is going to behave, but I should probably make this workas well.
Perhaps created lights using the context menu should have a target in the scene by default? I’m not sure, I think adding a button to the sidebar is the most elegant solution. But if anyone has any better ideas please let me know.