diff --git a/js/PointerCamera.js b/js/PointerCamera.js index b253115..c3cca82 100644 --- a/js/PointerCamera.js +++ b/js/PointerCamera.js @@ -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); } diff --git a/prototype/index.html b/prototype/index.html index 55284fe..6d2e0a8 100644 --- a/prototype/index.html +++ b/prototype/index.html @@ -16,7 +16,10 @@ the camera at anytime by clicking on the reset button.
- + + + + # diff --git a/prototype/js/main.js b/prototype/js/main.js index c590972..e7c03b7 100644 --- a/prototype/js/main.js +++ b/prototype/js/main.js @@ -22,19 +22,18 @@ function init() { // Add the listener on the button document.getElementById('reset').onclick = function() { cameras.mainCamera().reset(); }; var fullarrow = document.getElementById('fullarrow'); - fullarrow.onclick = function() { - if (fullarrow.innerHTML === 'Full arrow') { - fullarrow.innerHTML = "Half arrow"; - } else { - fullarrow.innerHTML = "Full arrow"; - } - + fullarrow.onchange = function() { cameras.map(function(camera) { if (camera instanceof FixedCamera) { - camera.fullArrow = !camera.fullArrow; + camera.fullArrow = fullarrow.checked; } }); - }; + } + + var collisions = document.getElementById('collisions'); + collisions.onchange = function() { + cameras.mainCamera().collisions = collisions.checked; + } // on initialise le moteur de rendu container = document.getElementById('container');