Improved camera movement
Added scale factor to the distance between `FixedCamera.center` and `FixedCamera.target` so the movement of `PointerCamera` does the rotation earlier in its movement. Changed threshold to consider the movement finished so the movement doesn't block the user for long.
This commit is contained in:
parent
0037b38357
commit
64c8b7de6d
|
@ -13,7 +13,6 @@ var FixedCamera = function(arg1, arg2, arg3, arg4, position, target) {
|
|||
this.position.z = position.z;
|
||||
}
|
||||
|
||||
|
||||
if (target === undefined)
|
||||
target = new THREE.Vector3(0,0,0);
|
||||
|
||||
|
@ -22,7 +21,7 @@ var FixedCamera = function(arg1, arg2, arg3, arg4, position, target) {
|
|||
direction.normalize();
|
||||
|
||||
this.target = this.position.clone();
|
||||
this.target.add(direction);
|
||||
this.target.add(Tools.mul(direction,10));
|
||||
this.up = new THREE.Vector3(0,0,1);
|
||||
|
||||
// Compute corners
|
||||
|
|
|
@ -56,8 +56,8 @@ PointerCamera.prototype.update = function() {
|
|||
this.position.add(Tools.mul(position_direction, 0.05));
|
||||
this.target.add(Tools.mul(target_direction, 0.05));
|
||||
|
||||
if (Tools.norm2(Tools.diff(this.position, this.new_position)) < 0.01 &&
|
||||
Tools.norm2(Tools.diff(this.target, this.new_target)) < 0.01) {
|
||||
if (Tools.norm2(Tools.diff(this.position, this.new_position)) < 0.1 &&
|
||||
Tools.norm2(Tools.diff(this.target, this.new_target)) < 0.1) {
|
||||
// this.position = this.new_position.clone();
|
||||
// this.target = this.new_target.clone();
|
||||
this.moving = false;
|
||||
|
|
Loading…
Reference in New Issue