From 77f04bab05c7430ebc554d9c8b36e6ce49975419 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Fri, 28 Feb 2020 16:43:13 +0100 Subject: [PATCH] Examples: Clean up. --- examples/webgl_decals.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/webgl_decals.html b/examples/webgl_decals.html index 3f7ac6a4c80e3f..db2289c961c917 100644 --- a/examples/webgl_decals.html +++ b/examples/webgl_decals.html @@ -38,6 +38,7 @@ normal: new THREE.Vector3() }; var mouse = new THREE.Vector2(); + var intersects = []; var textureLoader = new THREE.TextureLoader(); var decalDiffuse = textureLoader.load( 'textures/decal/decal-diffuse.png' ); @@ -174,8 +175,7 @@ if ( ! mesh ) return; raycaster.setFromCamera( mouse, camera ); - - var intersects = raycaster.intersectObjects( [ mesh ] ); + raycaster.intersectObject( mesh, false, intersects ); if ( intersects.length > 0 ) { @@ -198,6 +198,8 @@ intersection.intersects = true; + intersects.length = 0; + } else { intersection.intersects = false;