THREE.js : 2xMeshes 使用相同的向量作为位置 [英] THREE.js : 2xMeshes using same vector as position
问题描述
刚刚在 ThreeJS 中从 r67 - r69 进行了更新,最终在将它们的位置指向一个(相同)向量时遇到问题.
Just did an update from r67 - r69 in ThreeJS and ends up having problems referring their positions to one (same) vector.
在我这样做之前:
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
的 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;
相反,您必须使用其中一个
Instead, you must use either
object.position.set( x, y, z );
或
object.position.copy( vector );
three.js r.69
three.js r.69
这篇关于THREE.js : 2xMeshes 使用相同的向量作为位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!