Hello,
I thought asking here is the best place to start with this.
I have a HemisphericLight and a Gizmo to change the direction of the light but i would like something more user friendly than the Gizmo. Maybe a Slider that will change the direction of the light the same way the Gizmo does. Grabbing the red, green or blue circles of the gizmo to rotate them looks more of a Debug feature to me.
I added a Gizmo to a basic scene in the Playground just so that i can link a scene: Scene
I oppened this playground Slider
I will look into it a bit more but at 1st glance im having trouble because im working in Vue and i cant use BABYLON.
But usually i get an autocomplete suggestion when typing them because i have an imported folder: node_modules/babylonjs/core and all of this objects are there but i dont have GUI or AdvancedDynamicTexture so im lost at the start.
For example this is my code for creating lights: const hemiLight = new HemisphericLight( "hemiLight", new Vector3(1,5,-5), this.scene);
and at the top i automatically get Import { HemisphericLight } from "@babylonjs/core";
But if i understand the code here, im supposed to connect the light to the Slider? Not the Gizmo to the Slider.
I managed to import the GUI. Thank you very much.
I will update the post with any progress i make in regards to controlling the lights with the slider.
So, here is an update. I managed to actually connect the light to the slider but the only value im able to change is the intensity of the light, while with the Gizmo, it wasnt the intensity, it was the angle from which the light is hitting the scene.
This is the slider part of the code and im aware that im using sliderLight.intensity and thats why i have the result i that i have but i wasnt able to find any other option to change the lights.
Here for example is the slider controlling the x value of the light’s position. This is using a PointLight but for a HemisphericLight you could make sliders to control the x, y, and z values of its direction instead.
Thank you for your reply. I dont know why but i cant use .position.
I get the error: Property ‘position’ does not exist on type ‘HemisphericLight’.
And i get the same if i try to use a PointLight instead. its just
Property ‘position’ does not exist on type ‘PointLight’.
Ill have to look into it more.
For HemisphericLight you can control the direction with the slider like below. And above shows how to control the position of a PointLight. If can you post a PG with error if still having trouble, will help fix it.