From 8c5674b48f5b0e65379a78b43c3765de9e7bb83e Mon Sep 17 00:00:00 2001 From: Kevin Levron Date: Sat, 3 Apr 2021 00:59:58 +0200 Subject: [PATCH] intersectMode for raycaster --- src/core/Raycaster.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/core/Raycaster.js b/src/core/Raycaster.js index f45f0a1..3e57b0d 100644 --- a/src/core/Raycaster.js +++ b/src/core/Raycaster.js @@ -9,6 +9,7 @@ export default { onPointerMove: { type: Function, default: () => {} }, onPointerLeave: { type: Function, default: () => {} }, onClick: { type: Function, default: () => {} }, + intersectMode: { type: String, default: 'move' }, }, mounted() { this.rendererComponent.onMounted(() => { @@ -23,10 +24,17 @@ export default { onIntersectClick: this.onClick, }); this.pointer.addListeners(); + + if (this.intersectMode === 'frame') { + this.three.onBeforeRender(this.pointer.intersect); + } }); }, unmounted() { - if (this.pointer) this.pointer.removeListeners(); + if (this.pointer) { + this.pointer.removeListeners(); + this.three.offBeforeRender(this.pointer.intersect); + } }, methods: { getIntersectObjects() {