Update: CC - Mouse Move - Moorcow (8a0m30eevi.js) 208 bytes modified

beta.r3js.org
-=yb4f310 2017-11-14 08:58:26 +01:00
parent f5d175cb48
commit 430297c466
1 changed files with 17 additions and 14 deletions

View File

@ -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;
}
}
}
}
);