Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
78 views
in Technique[技术] by (71.8m points)

javascript - THREE.js : 2xMeshes using same vector as position

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.

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?

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

See the source code file Object3D.js.

You can no longer use the following pattern:

object.position = vector;

Instead, you must use either

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

or

object.position.copy( vector );

three.js r.69


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...