From c24fcbbe1180487872da9f98c7f9f2af2bddcc1d Mon Sep 17 00:00:00 2001 From: james Date: Mon, 14 Nov 2016 10:01:49 -0500 Subject: [PATCH] Removes intersector when hands exits scene --- src/leap-hand.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/leap-hand.js b/src/leap-hand.js index e375d48..d5c164d 100644 --- a/src/leap-hand.js +++ b/src/leap-hand.js @@ -92,8 +92,19 @@ module.exports = { this.release(null); } - if ( hand && !this.isVisible) this.handMesh.show(); - if (!hand && this.isVisible) this.handMesh.hide(); + if (hand && !this.isVisible) { + this.handMesh.show(); + if (this.intersector.getMesh()) { + this.el.object3D.add(this.intersector.getMesh()); + } + } + + if (!hand && this.isVisible) { + this.handMesh.hide(); + if (this.intersector.getMesh()) { + this.el.object3D.remove(this.intersector.getMesh()); + } + } this.isVisible = !!hand; },