THREE.js:2xMeshes使用相同的向量作为位置 [英] THREE.js : 2xMeshes using same vector as position

查看:136
本文介绍了THREE.js:2xMeshes使用相同的向量作为位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚刚在ThreeJS中从r67-r69进行了更新,最终在将其位置引用到一个(相同)向量时遇到了问题。

Just did an update from r67 - r69 in ThreeJS and ends up having problems referring their positions to one (same) vector.

在我做这个之前有效:

Before I did this which worked:

var vector = new THREE.Vector3(50, 50, 50);
_Mesh1.position = vector;
_Mesh2.position = vector;

这使我有可能在移动其中一个网格时移动另一个网格。

which made it possible that when I moved one of the meshes it moved the other one as well.

在r69中,位置矢量保持不变(也就是0,0,0),这意味着每当我必须手动设置每个网格的X,Y和Z坐标模式另一个。

In r69 the position vector remains the same (aka 0, 0, 0) which means that I have to manually set the X, Y and Z coords for each mesh whenever I mode another one.

我在这里错过了一些变化吗?或者我该怎么做才能解决这个问题?

Am I missing some change here? Or what should I do to fix this?

推荐答案

Object3D 's position rotation quaternion scale 属性现在是不可变的。

Object3D's position, rotation, quaternion and scale properties are now immutable.

查看源代码文件 Object3D.js

您不能再使用以下模式:

You can no longer use the following pattern:

object.position = vector;

相反,你必须使用

object.position.set( x, y, z );

object.position.copy( vector );

three.js r.69

three.js r.69

这篇关于THREE.js:2xMeshes使用相同的向量作为位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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