Control Three.js scene with dat.gui.js

I’m trying to use dat.gui.js to create a UI for Three.js scene. I want to enable, disable measureDistance function via dat.gui. You can view the CodePen here. I really appreciate any help.
Thank you very much

I’m afraid it’s not clear what you are asking for. You have to describe more detailed what you are looking for.

In this codepen there is a function which does the measuring distances between points. You have to enable and again disable the distance check box to see it in action. It won’t turn off again. I don’t understand how I can make this work right.
I want to simply click on distance check box and be able to enable or disable the distance measurements. You can see a similar working example here
Thank you

I’ve managed to develop the codepen a little. Now all the visual elements will be hidden or visible in sync with Distance check box. But the measureDistance function is still running. I need to stop it from running when the Distance check box is unchecked

All good. I’ve managed to do this by adding a if { } else { } inside mousedown event.

1 Like