Copy of position vector

This commit is contained in:
Thomas FORGIONE 2015-07-07 09:13:11 +02:00
parent 6dc9faf493
commit c9bfc2dedd
1 changed files with 3 additions and 4 deletions

View File

@ -57,7 +57,8 @@ L3D.PointerCamera = function() {
* Current position of the camera (optical center) * Current position of the camera (optical center)
* @type {THREE.Vector} * @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 * Current direction of the camera
@ -295,9 +296,7 @@ L3D.PointerCamera.prototype.linearMotion = function(time) {
*/ */
L3D.PointerCamera.prototype.hermiteMotion = function(time) { L3D.PointerCamera.prototype.hermiteMotion = function(time) {
var e = this.hermitePosition.eval(this.t); var e = this.hermitePosition.eval(this.t);
this.position.x = e.x; this.position.copy(e);
this.position.y = e.y;
this.position.z = e.z;
this.target = L3D.Tools.sum(this.position, this.hermiteAngles.eval(this.t)); this.target = L3D.Tools.sum(this.position, this.hermiteAngles.eval(this.t));