Changed to atan2

This commit is contained in:
Thomas FORGIONE 2015-04-08 14:38:53 +02:00
parent 729aaa09c2
commit ed5df6949c
1 changed files with 4 additions and 4 deletions

View File

@ -57,7 +57,7 @@ PointerCamera.prototype.update = function() {
this.target.add(Tools.mul(target_direction, 0.05)); this.target.add(Tools.mul(target_direction, 0.05));
if (Tools.norm2(Tools.diff(this.position, this.new_position)) < 1 && 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.position = this.new_position.clone();
// this.target = this.new_target.clone(); // this.target = this.new_target.clone();
this.moving = false; this.moving = false;
@ -68,9 +68,9 @@ PointerCamera.prototype.update = function() {
this.phi = Math.asin(forward.z); this.phi = Math.asin(forward.z);
// Don't know why this line works... But thanks Thierry-san because // Don't know why this line works... But thanks Thierry-san and
// it seems to work... // Bastien because it seems to work...
this.theta = Math.atan(forward.y / forward.x) + Math.PI; this.theta = Math.atan2(forward.y, forward.x);
} }