I noticed that when setting the position for PerspectiveCamera to a THREE.Vector3 nothing is displayed, but when I directly set the values, it works just fine.
camera.position.set( 0, 0, 0 );
works, but
var newVector = new THREE.Vector3(0, 0, 0)
camera.position.set(newVector);
doesn't. I was wondering if this is a bug?
See the following two JSFiddle:
L8-10: https://jsfiddle.net/4zqkn7yw/5/
L9: https://jsfiddle.net/4zqkn7yw/4/
That's not a bug. Try this:
var newVector = new THREE.Vector3( 0, 0, 0 )
camera.position.copy( newVector );
Have a look at the docs of Vector3 in order to understand the API.
Object3D
's position
, rotation
, quaternion
and scale
properties are immutable.
The following pattern is invalid:
object.position = vector;
Instead, you must use either
object.position.set( x, y, z );
or
object.position.copy( vector );
See Object3D.js
.
Most helpful comment
Object3D
'sposition
,rotation
,quaternion
andscale
properties are immutable.The following pattern is invalid:
Instead, you must use either
or
See
Object3D.js
.