From 7d4c06ac09df94b46d6f95d6ea4886156416c849 Mon Sep 17 00:00:00 2001 From: Fabien Benetou Date: Wed, 4 Sep 2024 11:02:28 +0200 Subject: [PATCH] on enter XR don't start wrist shortcut, add billboarding without activating it --- index.html | 12 +++++++----- jxr-core.js | 8 +++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index 45c475a..d333306 100644 --- a/index.html +++ b/index.html @@ -75,6 +75,8 @@ AFRAME.registerComponent('selector-line', { //console.log( startPos, worldPosition) }, +// try pinching modifier, e.g pinch while holding the SHIFT key + }) @@ -98,13 +100,13 @@ AFRAME.registerComponent('selector-line', { - + - - + + - - + + diff --git a/jxr-core.js b/jxr-core.js index fa70128..4dac9fb 100644 --- a/jxr-core.js +++ b/jxr-core.js @@ -154,13 +154,14 @@ AFRAME.registerComponent('pinchprimary', { // currently only 1 hand, the right o let dist = 100 if ( document.querySelector("#box") ) dist = event.detail.position.distanceTo( document.querySelector("#box").object3D.position ) - if (dist < .1){ + if (dist < .1){ setFeedbackHUD("close enough, replaced shortcut with "+ selectedElement.getAttribute("value") ) wristShortcut = selectedElement.getAttribute("value") } if (selectedElement){ let content = selectedElement.getAttribute("value") selectedElement.emit('released', {element:selectedElement, timestamp:Date.now(), primary:true}) + // selectedElement.object3D.rotation.set( 0, 0, 0 ) // billboarding, could need modifier } // unselect current target if any selectedElement = null; @@ -577,7 +578,7 @@ function doublePinchToScale(){ AFRAME.registerComponent('pressable', { schema:{pressDistance:{default:0.06}}, init:function(){this.worldPosition=new THREE.Vector3();this.handEls=document.querySelectorAll('[hand-tracking-controls]');this.pressed=false;}, - tick:function(){var handEls=this.handEls;var handEl;var distance;for(var i=0;i 0 && distance