1、引入 <script type="text/javascript" src="../libs/OrbitControls.js"></script> ,请修改OrbitControls对应的地址
2、创建对象
function initControls() {
controls = new THREE.OrbitControls(camera);
controls.addEventListener('change', render);
controls.autoRotate = false; //自动旋转开关
controls.autoRotateSpeed = 2;
}
3,在animate方法中调用Controls对象
function render() {
//plane.rotation.y = step += 0.01;
renderer.render(scene, camera);
}
function animate() {
// render using requestAnimationFrame
requestAnimationFrame(animate);
controls.update();
}