![](/img/trans.png)
[英]how to save dat.gui parameter to backend, i am using django and three.js and dat.gui
[英]Three.js How to convert values to degrees in the control panel using dat.GUI?
您将不得不创建一个占位符 object 以度为单位保存值,然后使用.onChange()
事件来了解值何时更改。 那时您可以将度数转换为弧度以分配给网格旋转。
// Placeholder holds values in degrees
var degrees = {
x: 0,
y: 0,
z: 0
};
gui
.add(degrees, "x")
.min(-180)
.max(180)
.step(1)
// This function is called each time the value is changed
.onChange(() => {
console.log(degrees.x);
// Convert the degrees to radians, then assign to mesh rotation
mesh.rotation.x = THREE.MathUtils.degToRad(degrees.x);
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.