How to make auto rotate of OrbitControls stop when mouse interactive, and after few second it start like P3D.in does here with their logo (http://p3d.in/)

有帮助吗?

解决方案 2

controls.autoRotate = false;

Just start it on init with 'true', then onMouseMove, do something like:

if (controls.AutoRotate)
  controls.autoRotate = false;

其他提示

For people googling, if you want to stop the autorotate after the first interaction; you can hook up an event listener on one of the 3 events OrbitControls emits:

// stop autorotate after the first interaction
controls.addEventListener('start', function(){
  controls.autoRotate = false;
});

Or even more advanced, restart the autorotate after the user has ended the last interaction, with a timeout of 1000 milliseconds:

// 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);
});
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top