From 430297c466a4fa37cc79e5ef57d18e5ebfb8bcd4 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Tue, 14 Nov 2017 08:58:26 +0100 Subject: [PATCH] Update: CC - Mouse Move - Moorcow (8a0m30eevi.js) 208 bytes modified --- 8a0m30eevi.js | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/8a0m30eevi.js b/8a0m30eevi.js index 3a14296..dc2f8a0 100644 --- a/8a0m30eevi.js +++ b/8a0m30eevi.js @@ -3,6 +3,7 @@ if (!this.entityLoaded) { } if (!this.initialized) { + this.mouseIsDown = false; //gets set from MouseDown this.mouse = this.entityLoaded.mouse; this.raycaster = this.entityLoaded.raycaster; this.camera = this.entityLoaded.camera; @@ -53,11 +54,9 @@ this.throwerParticleEngine.position.y = this.thrower.position.y + this.raycaster this.throwerParticleEngine.position.z = this.thrower.position.z + this.raycaster.direction.z * 6; this.throwerParticleEngine.updateInstance('position'); - - +/* this.scene.meshes.map( function(mesh) { - if (mesh.instance.material instanceof Array) { mesh.instance.material.map( function(material) { @@ -69,6 +68,7 @@ this.scene.meshes.map( } } ); +*/ var intersects = this.raycaster.getIntersectedObjects(this.scene.meshes); intersects.map( @@ -84,18 +84,21 @@ intersects.map( mesh.name.indexOf('Stone') === -1 //stones ) { - if (this.mouseIsDown) - - if (mesh.instance.material instanceof Array) { - mesh.instance.material.map( - function(material) { - material.color.setHex(0xff0000); - } - ); - } else { - mesh.instance.material.color.setHex(0xff0000); + if (this.mouseIsDown) { + if (mesh.instance.material instanceof Array) { + mesh.instance.material.map( + function(material) { + material.color.r -= 0.01; + material.color.g -= 0.01; + material.color.b -= 0.01; + } + ); + } else { + mesh.instance.material.color.r -= 0.01; + mesh.instance.material.color.g -= 0.01; + mesh.instance.material.color.b -= 0.01; + } } - } } );