Options for collision

This commit is contained in:
Thomas FORGIONE
2015-04-22 11:02:54 +02:00
parent 7b5b94947a
commit 8a486cd723
3 changed files with 15 additions and 11 deletions

View File

@@ -52,6 +52,8 @@ var PointerCamera = function() {
listenerTarget.addEventListener('mousemove', onMouseMove, false);
listenerTarget.addEventListener('mouseup', onMouseUp, false);
listenerTarget.addEventListener('mouseout', onMouseUp, false);
this.collisions = true;
}
PointerCamera.prototype = Object.create(THREE.PerspectiveCamera.prototype);
PointerCamera.prototype.constructor = PointerCamera;
@@ -137,7 +139,7 @@ PointerCamera.prototype.update = function() {
if (this.moveLeft) direction.add(Tools.mul(left, speed));
if (this.moveRight) direction.sub(Tools.mul(left, speed));
if (!this.isColliding(direction)) {
if (!this.collisions || !this.isColliding(direction)) {
this.position.add(direction);
}