const controls = new OrbitControls( camera, renderer.domElement );
它的构造函数的第一个参数需要传入摄像机,第二个参数传入了 渲染器的 dom元素
1 2 3 4 5 6 7 8 9 10
constructor( object, domElement ) {
super(); if ( domElement === undefined ) console.warn( 'THREE.OrbitControls: The second parameter "domElement" is now mandatory.' ); if ( domElement === document ) console.error( 'THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.' );