我有一个加载了 three.js 的 3D 对象,应该只能从前面看到它,因为它是一个平面,从后面看它是透明的 ...
通过 orbitContronls,我限制了方位 Angular 和极 Angular 的偏移......
为了让 3D 更吸引人,它应该开始旋转......
function animate() {
if ( mesh ) {
mesh.rotation.y += .005;
}
requestAnimationFrame( animate );
render();
}
如何将运动限制在 -90° 和 90° 之间来回?
最佳答案
您可以使用Math.sin()
function animate() {
requestAnimationFrame( animate );
if ( mesh ) {
mesh.rotation.y = Math.sin(Date.now() * 0.001) * Math.PI * 0.5;
}
render();
}
关于javascript - Three.js:在两个方位 Angular 之间来回旋转一个物体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40966828/