I'm using threejs and dat.gui to test my mesh, but i need to use gui that accept number, but when I try to use it, I have the following error : gui.add(...).min is not a function
my code is :
const params = {
action: (value) => {
console.log(value);
},
};
gui
.add(params , "action")
.min(0)
.max(5)
.step(1)
This is not an issue about importing dat.gui since I use if with another function like
gui.add(mesh, "visible");
That is working
I need to use gui.add with min max and step function in order to change the value manually for my mesh
CodePudding user response:
When you use min max with gui for custom function, you need to initiate a default value and use the .onChange
event callback !
const params = {
baseValue: 0,
};
gui
.add(params, "baseValue")
.min(0)
.max(5)
.step(1)
.onChange((value) => {
console.log(value);
});