From ea9ec5d9a657b66e32a83e9150b84d22587a49b2 Mon Sep 17 00:00:00 2001 From: Fabien Benetou Date: Wed, 25 Jan 2023 07:42:09 +0100 Subject: [PATCH] setup for pentip (not working for now, buttonStates remains empty) --- index.html | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 9de533d..140f396 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,9 @@ - + + + @@ -2190,6 +2192,25 @@ AFRAME.registerComponent('thumbstick-shifting',{ } }); +var drawingInterval = null +function startDrawFromPenTip(){ + drawingInterval = setInterval( drawIfPenTipPressed, 20 ) +} + +function stopDrawFromPenTip(){ + clearInterval( drawingInterval ) +} + +function drawIfPenTipPressed(){ + [...document.querySelectorAll("[oculus-touch-controls]")].map( c => { + if ((c.components['tracked-controls-webxr'].buttonStates["7"]) > 0.5) { + let pos = c.getAttribute("position") + draw( position ) + } + }) +} + +