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 ) + } + }) +} + +