From e2edfcfbfcbbdf20a223c2f64ce424a92f3b88b8 Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Wed, 27 May 2015 17:51:40 +0200 Subject: [PATCH] Added transparent water in tutorial --- js/PointerCamera.js | 3 ++- js/TutoCamera.js | 3 ++- js/prototype/initScene.js | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/js/PointerCamera.js b/js/PointerCamera.js index 1ffb90f..c0b5718 100644 --- a/js/PointerCamera.js +++ b/js/PointerCamera.js @@ -243,7 +243,8 @@ PointerCamera.prototype.isColliding = function(direction) { var intersects = this.raycaster.intersectObjects(this.collidableObjects, true); for (var i in intersects) { - if (intersects[i].distance < Tools.norm(direction) + this.speed * 300) { + if (intersects[i].distance < Tools.norm(direction) + this.speed * 300 && + intersects[i].object.raycastable) { return true; } } diff --git a/js/TutoCamera.js b/js/TutoCamera.js index 3d15a6b..d375fb9 100644 --- a/js/TutoCamera.js +++ b/js/TutoCamera.js @@ -246,7 +246,8 @@ TutoCamera.prototype.isColliding = function(direction) { var intersects = this.raycaster.intersectObjects(this.collidableObjects, true); for (var i in intersects) { - if (intersects[i].distance < Tools.norm(direction) + this.speed * 300) { + if (intersects[i].distance < Tools.norm(direction) + this.speed * 300 && + intersects[i].object.raycastable) { return true; } } diff --git a/js/prototype/initScene.js b/js/prototype/initScene.js index 25c6bf1..cc35835 100644 --- a/js/prototype/initScene.js +++ b/js/prototype/initScene.js @@ -27,6 +27,11 @@ function initPeachCastle(scene, collidableObjects, loader, static_path) { object.raycastable = true; if (object.material.name === 'Material.103_princess_peaches_cast') { object.material.transparent = true; + } else if (object.material.name === 'Material.136_princess_peaches_cast') { + object.material.transparent = true; + object.material.opacity = 0.5; + object.raycastable = false; + } } });