效果图:
1、引入插件
import { GUI } from 'three/examples/jsm/libs/dat.gui.module'
2、使用
this.scene.add(box)
const gui = new GUI()
this.makeXYZGUI(gui, box.position, 'position')
makeXYZGUI (gui, vector3, name) {
const folder = gui.addFolder(name)
folder.add(vector3, 'x', -1000, 1000, 0.01)
folder.add(vector3, 'y', 0, 10, 0.1)
folder.add(vector3, 'z', -1000, 1000, 0.01)
folder.open()
}