三.js 如何通过 id(name) 获取场景 [英] three.js how to get scene by id(name)

查看:33
本文介绍了三.js 如何通过 id(name) 获取场景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个场景;我怎样才能通过 id(name) 获取它?喜欢 jquery(#test)?

I created a scene; How can I get it by id(name)? Like jquery(#test)?

three.js 文档中,我只找到了 scene.getObjectById() 来获取儿童 obj.

In three.js doc,I just find the scene.getObjectById() to get children obj.

推荐答案

你有没有搜索过?

getObjectByName方法rel="nofollow">此处位于 Object3D中.
此处也在文档中提及.

There is a getObjectByName method for this here in the Object3D class.
And here it is also mentioned in the documentation.

getObjectByNamegetObjectById 方法都是在父对象中查找子对象.场景没有父级,因此按 id 查找场景或按名称查找场景没有多大意义...

Both the getObjectByName and the getObjectById methods are to find children objects inside a parent object. A scene doesn't have a parent so finding scene by id or finding scene by name doesn't make much sense...

这篇关于三.js 如何通过 id(name) 获取场景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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