From c9bfc2deddc46e60a78d91e2ec357ca6e4e39d25 Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Tue, 7 Jul 2015 09:13:11 +0200 Subject: [PATCH] Copy of position vector --- js/l3d/src/cameras/PointerCamera.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/js/l3d/src/cameras/PointerCamera.js b/js/l3d/src/cameras/PointerCamera.js index d29d9d8..82aa11b 100644 --- a/js/l3d/src/cameras/PointerCamera.js +++ b/js/l3d/src/cameras/PointerCamera.js @@ -57,7 +57,8 @@ L3D.PointerCamera = function() { * Current position of the camera (optical center) * @type {THREE.Vector} */ - this.position = new THREE.Vector3(); + // We use copy because THREE.Object3D.position is immutable + this.position.copy(new THREE.Vector3()); /** * Current direction of the camera @@ -295,9 +296,7 @@ L3D.PointerCamera.prototype.linearMotion = function(time) { */ L3D.PointerCamera.prototype.hermiteMotion = function(time) { var e = this.hermitePosition.eval(this.t); - this.position.x = e.x; - this.position.y = e.y; - this.position.z = e.z; + this.position.copy(e); this.target = L3D.Tools.sum(this.position, this.hermiteAngles.eval(this.t));