Fixed yaw.
authorEugen Sawin <sawine@me73.com>
Thu, 21 Apr 2011 13:12:49 +0200
changeset 2046b2839f6f50
parent 19 15d61d76daa1
child 21 834972f6aaf0
Fixed yaw.
scripts/machine.js
     1.1 --- a/scripts/machine.js	Thu Apr 21 03:12:51 2011 +0200
     1.2 +++ b/scripts/machine.js	Thu Apr 21 13:12:49 2011 +0200
     1.3 @@ -61,7 +61,7 @@
     1.4      this.pos = vec3.create([0, 0, 7]);
     1.5      this.up = vec3.create([0, 1, 0]);
     1.6      this.right = vec3.create([1, 0, 0]);
     1.7 -    this.target = vec3.create([0, 0, 1]);
     1.8 +    this.target = vec3.create([0, 0, -1]);
     1.9      this.matrix = mat4.create();
    1.10  }
    1.11  Camera.prototype.moveLeft = function()
    1.12 @@ -91,7 +91,7 @@
    1.13  Camera.prototype.zoom = function(delta) 
    1.14  {
    1.15      var dir = vec3.create(this.target);
    1.16 -    vec3.scale(dir, -delta * this.speed.zoom);
    1.17 +    vec3.scale(dir, delta * this.speed.zoom);
    1.18      vec3.add(this.pos, dir); 
    1.19  }
    1.20  Camera.prototype.pitch = function(delta)
    1.21 @@ -109,6 +109,7 @@
    1.22      vec3.normalize(right);
    1.23      this.right = right;
    1.24      vec3.cross(this.right, this.up, target);
    1.25 +    vec3.scale(target, -1);
    1.26      this.target = target;
    1.27      vec3.normalize(this.target);
    1.28  }
    1.29 @@ -124,7 +125,7 @@
    1.30      this.matrix = mat4.create([this.right[0], this.up[0], -this.target[0], 0,
    1.31  			       this.right[1], this.up[1], -this.target[1], 0,
    1.32  			       this.right[2], this.up[2], -this.target[2], 0,
    1.33 -			       -x, -y, -z, 1]);
    1.34 +			       -x, -y, z, 1]);
    1.35      
    1.36  }
    1.37  Camera.prototype.clear = function()