![](/img/trans.png)
[英]How do I slerp back and forth between quaternions for camera object in three.js?
[英]Three.js: rotate an object back and forth between two azimuth angles
我有一個加載了three.js的3D對象,應該只從正面看,因為它是一個平面,從背面看是透明的...
使用orbitContronls,我可以限制方位角和極角的偏移...
為了使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();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.