Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 486
Yenza Avatar asked Nov 13 '14 09:11

Yenza


1 Answers

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

like image 104
WestLangley Avatar answered Oct 11 '22 21:10

WestLangley