From 407de3e918da0a805a05c34a1e9155e5a46e1a35 Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Wed, 20 May 2015 17:29:42 +0200 Subject: [PATCH] Change color of camera when clicked --- static/js/prototype/ArrowCamera.js | 7 +++++++ static/js/prototype/OldFixedCamera.js | 2 ++ static/js/prototype/raycasterTools.js | 1 + 3 files changed, 10 insertions(+) diff --git a/static/js/prototype/ArrowCamera.js b/static/js/prototype/ArrowCamera.js index 2085cde..5ffb592 100644 --- a/static/js/prototype/ArrowCamera.js +++ b/static/js/prototype/ArrowCamera.js @@ -41,6 +41,13 @@ var ArrowCamera = function(arg1, arg2, arg3, arg4, position, target) { ArrowCamera.prototype = Object.create(THREE.PerspectiveCamera.prototype); ArrowCamera.prototype.constructor = ArrowCamera; +ArrowCamera.prototype.check = function() { + this.object3D.traverse(function(obj) { + if (obj instanceof THREE.Mesh) + obj.material.color.setHex(0x663366); + }); +} + ArrowCamera.prototype.initExtremity = function() { var geometry = new THREE.Geometry(); diff --git a/static/js/prototype/OldFixedCamera.js b/static/js/prototype/OldFixedCamera.js index 0636443..07daf80 100644 --- a/static/js/prototype/OldFixedCamera.js +++ b/static/js/prototype/OldFixedCamera.js @@ -91,6 +91,8 @@ var OldFixedCamera = function(arg1, arg2, arg3, arg4, position, target) { OldFixedCamera.prototype = Object.create(THREE.PerspectiveCamera.prototype); OldFixedCamera.prototype.constructor = OldFixedCamera; +OldFixedCamera.prototype.check = function() {} + // Update function OldFixedCamera.prototype.update = function(position) { // Compute distance between center of camera and position diff --git a/static/js/prototype/raycasterTools.js b/static/js/prototype/raycasterTools.js index 6c40f11..4ad2814 100644 --- a/static/js/prototype/raycasterTools.js +++ b/static/js/prototype/raycasterTools.js @@ -79,6 +79,7 @@ CameraSelecter.prototype.click = function(event) { event.arrow_id = cameras.cameras.indexOf(newCamera); event.send(); + newCamera.check(); this.cameras.mainCamera().moveHermite(newCamera); buttonManager.updateElements(); } else if (newCamera instanceof Coin) {