Added transparent water in tutorial

This commit is contained in:
Thomas FORGIONE 2015-05-27 17:51:40 +02:00
parent 00d3d8ce10
commit e2edfcfbfc
3 changed files with 9 additions and 2 deletions

View File

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

View File

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

View File

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