OrbitControls和dat.gui文本不起作用 [英] OrbitControls and dat.gui text doesn't work

查看:420
本文介绍了OrbitControls和dat.gui文本不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有 text 属性的three.js和dat.gui。

I am using three.js and dat.gui with a text property.

另外,我的场景中有OrbitControls:

Also, I have OrbitControls in my scene:

cameraControl = new THREE.OrbitControls(camera);
cameraControl.update();

但是这种场景存在问题。 GUI上的文本不起作用。您无法在该框中输入任何内容。而且我已经调试了它,问题是由OrbitControls引起的。

But there is a problem with this kind of scene. The text at the GUI doesn't work. You can't type anything in that box. And I have debugged it, and the problem is caused by OrbitControls.

您知道解决该问题的方法或变通办法吗?谢谢!

Do you know a way or workaround to solve it? Thanks!

推荐答案

您需要传递您想从中监听事件的dom元素。

You need to pass the dom element you want to listen the events from.

cameraControl = new THREE.OrbitControls(camera,renderer.domElement);

否则 OrbitControls 将事件添加到文档中并且与DAT.GUI冲突。

Otherwise OrbitControls adds the events to the document and that conflicts with DAT.GUI.

这篇关于OrbitControls和dat.gui文本不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆