OrbitControls在交互时自动旋转停止?
问题描述:
如何使OrbitControls的自动旋转停止时鼠标交互,和几秒钟后,开始喜欢P3D.in确实在这里与他们的标志(http://p3d.in/)OrbitControls在交互时自动旋转停止?
答
controls.autoRotate = false;
刚开始它与“真”,则初始化的OnMouseMove,这样做:
if (controls.AutoRotate)
controls.autoRotate = false;
答
对于谷歌搜索的人,如果你想在第一交互后停止自动旋转;你可以挂钩一个事件侦听器的3个事件OrbitControls的一个发出:
// stop autorotate after the first interaction
controls.addEventListener('start', function(){
controls.autoRotate = false;
});
甚至更先进的,重新启动自动旋转的用户已经结束了最后的互动后,与1000毫秒为单位:
// stop autorotate after the first interaction
controls.addEventListener('start', function(){
clearTimeout(autorotateTimeout);
controls.autoRotate = false;
});
// restart autorotate after the last interaction & an idle time has passed
this.controls.addEventListener('end', function(){
autorotateTimeout = setTimeout(function(){
controls.autoRotate = true;
}, 1000);
});
我做到了,非常感谢你。 – n2g6t1q1