Change color of camera when clicked

This commit is contained in:
Thomas FORGIONE 2015-05-20 17:29:42 +02:00
parent e841075b0d
commit 407de3e918
3 changed files with 10 additions and 0 deletions

View File

@ -41,6 +41,13 @@ var ArrowCamera = function(arg1, arg2, arg3, arg4, position, target) {
ArrowCamera.prototype = Object.create(THREE.PerspectiveCamera.prototype); ArrowCamera.prototype = Object.create(THREE.PerspectiveCamera.prototype);
ArrowCamera.prototype.constructor = ArrowCamera; 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() { ArrowCamera.prototype.initExtremity = function() {
var geometry = new THREE.Geometry(); var geometry = new THREE.Geometry();

View File

@ -91,6 +91,8 @@ var OldFixedCamera = function(arg1, arg2, arg3, arg4, position, target) {
OldFixedCamera.prototype = Object.create(THREE.PerspectiveCamera.prototype); OldFixedCamera.prototype = Object.create(THREE.PerspectiveCamera.prototype);
OldFixedCamera.prototype.constructor = OldFixedCamera; OldFixedCamera.prototype.constructor = OldFixedCamera;
OldFixedCamera.prototype.check = function() {}
// Update function // Update function
OldFixedCamera.prototype.update = function(position) { OldFixedCamera.prototype.update = function(position) {
// Compute distance between center of camera and position // Compute distance between center of camera and position

View File

@ -79,6 +79,7 @@ CameraSelecter.prototype.click = function(event) {
event.arrow_id = cameras.cameras.indexOf(newCamera); event.arrow_id = cameras.cameras.indexOf(newCamera);
event.send(); event.send();
newCamera.check();
this.cameras.mainCamera().moveHermite(newCamera); this.cameras.mainCamera().moveHermite(newCamera);
buttonManager.updateElements(); buttonManager.updateElements();
} else if (newCamera instanceof Coin) { } else if (newCamera instanceof Coin) {