Three.js & Dat.gui - TrackballControls renderer.domElement disables rotate and pan

﹥>﹥吖頭↗ 提交于 2019-12-02 01:15:33
rjd

I debugged the issue with the help of this post: Three.js Restrict the mouse movement to Scene only.

Apparently, if you append the renderer.domElement child after initializing the trackballControls, it doesn't know anything about the renderer.domElement object. This also does something strange to dat.gui as described previously.

Basically, make sure this line:

document.getElementById("WebGL-output").appendChild(renderer.domElement);

appears before this line:

var trackballControls = new THREE.TrackballControls(camera, renderer.domElement);

Make sure the renderer DOM element is added to the html before it is being used as a reference.

document.body.appendChild(renderer.domElement);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!