setup for pentip (not working for now, buttonStates remains empty)

hands-controllers-kbd
Fabien Benetou 2 years ago
parent df8641a271
commit ea9ec5d9a6
  1. 23
      index.html

@ -4,7 +4,9 @@
<head>
<!-- Suggestions? https://git.benetou.fr/utopiah/text-code-xr-engine/issues/ -->
<script src='dependencies/aframe.min.js'></script>
<!-- <script src='dependencies/aframe.min.js'></script>-->
<script src="https://aframe.io/releases/1.4.1/aframe.min.js"></script> <!-- for pro controls -->
<script src='dependencies/aframe-html.js'></script>
<script src='dependencies/aframe-mirror.js'></script>
<script src='dependencies/aframe-troika-text.min.js'></script>
@ -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 )
}
})
}
</script>
<div id="observablehq-key">
<div id="observablehq-viewof-offsetExample-ab4c1560"></div>

Loading…
Cancel
Save