From ed5df6949cf43633747113d8b552ffc9710d2850 Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Wed, 8 Apr 2015 14:38:53 +0200 Subject: [PATCH] Changed to atan2 --- js/PointerCamera.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/PointerCamera.js b/js/PointerCamera.js index d90fe25..abebd59 100644 --- a/js/PointerCamera.js +++ b/js/PointerCamera.js @@ -57,7 +57,7 @@ PointerCamera.prototype.update = function() { this.target.add(Tools.mul(target_direction, 0.05)); if (Tools.norm2(Tools.diff(this.position, this.new_position)) < 1 && - Tools.norm2(Tools.diff(this.target, this.new_target)) < 1){ + Tools.norm2(Tools.diff(this.target, this.new_target)) < 1) { // this.position = this.new_position.clone(); // this.target = this.new_target.clone(); this.moving = false; @@ -68,9 +68,9 @@ PointerCamera.prototype.update = function() { this.phi = Math.asin(forward.z); - // Don't know why this line works... But thanks Thierry-san because - // it seems to work... - this.theta = Math.atan(forward.y / forward.x) + Math.PI; + // Don't know why this line works... But thanks Thierry-san and + // Bastien because it seems to work... + this.theta = Math.atan2(forward.y, forward.x); }