如何在 Three.js 中克隆 object3d? [英] How to clone an object3d in Three.js?

查看:49
本文介绍了如何在 Three.js 中克隆 object3d?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想克隆一个加载了加载器的模型,我发现了这个问题在github上,但解决方案不起作用.Object3D 似乎发生了结构性变化.

I want to clone a model loaded with loader, I found this issue on github,but the solution doesn't work. It seems there has been an structural change in Object3D.

如何在 Three.js 的当前稳定版本中克隆 Object3D?

How can I clone an Object3D in current stable version of Three.js?

推荐答案

在这个新版本的 Three.js 中,你有一个方法 clone.

In this new version of three.js you have a method clone.

例如,我使用国际象棋中的皇后,我不得不多次复制:

For example, I use a queen from chess and I had to duplicate multiple times:

// queen is a mesh
var newQueen = queen.clone();

// make sure to re position to be able to see the new queen!
newQueen.position.set(100,100,100); // or any other coordinates

它适用于任何网格.

我使用了three.js r61.

I used three.js r61.

这篇关于如何在 Three.js 中克隆 object3d?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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