diff --git a/index.html b/index.html index c1ffc3b..8bea410 100644 --- a/index.html +++ b/index.html @@ -17,12 +17,34 @@ AFRAME.registerComponent('startfunctions', { init: function(){ - let newEl = document.createElement('a-entity') - newEl.setAttribute('instruction-machine', '') - AFRAME.scenes[0].appendChild(newEl) + let newEl = document.createElement('a-entity') + newEl.setAttribute('instruction-machine', '') + AFRAME.scenes[0].appendChild(newEl) + + let el = document.createElement('a-sphere') + el.setAttribute('radius', '.01') + el.setAttribute('target', '') + el.setAttribute('position', '0 1 -.5') + AFRAME.scenes[0].appendChild(el) + el.setAttribute("onpicked", "window.pfb = selectedElements.at(-1).element.getAttribute('position').clone();") + el.setAttribute("onreleased", "twoPosToBox(window.pfb, selectedElements.at(-1).element.getAttribute('position'));") + // event detail is available within that code as a e.detail e.g e.detail.element } }) +function twoPosToBox(A, B){ + let center = A.clone() + center.add(B) + center.divideScalar(2) + let lengthes = A.clone() + lengthes.sub(B) + let el = document.createElement("a-box") + el.setAttribute("position", center ) + el.setAttribute('target', '') + el.setAttribute("scale", lengthes.toArray().map( i => Math.abs(i) ).join(" ") ) + AFRAME.scenes[0].appendChild(el) +} + // import from https://fabien.benetou.fr/PIMVRdata/SpaSca3DPrinterInstructions?action=source // but as text editable format, not code // would be safer to do few examples BEFORE synthesizing to a flexible enough format, just with mini games before @@ -43,6 +65,20 @@ AFRAME.registerComponent('instruction-machine', { // port a text version, i.e no 6DoF or hand tracking, to Monocle/Frame // adapt from wiki sequential instructions part, possibly with some images // consider https://threejs.org/docs/?q=grid#api/en/helpers/GridHelper too + // hiding panel, like whiteboards/blackboards in order to focus on solely the task at hand + // optional blinders managed by the user + // overall guiding principle, finding the sweet spot of signal/noise ratio + // starting with a lot of blinders then gradually removing them + // potentially leading to open a set of other instructions next to it + // and find combinatorial opportunities + // wall aligning before starting, this way snap would make sense too + // could be done via GridHelper rather than primitive + // requirement, i.e this instruction needs that other instruction to be completed before + // leading to a graph Sasha Kaurov (IAS) as discussed a while ago with X and experienced via Khan Academy (esp. in math) + // can also list optional requirements + // get model of space https://twitter.com/utopiah/status/1712340651453411808 + // can prepare remotely, i.e in VR, to either train virtually in-situ + // to build the instruction sets schema: {default: diff --git a/jxr-core.js b/jxr-core.js index ae229d6..bcb892a 100644 --- a/jxr-core.js +++ b/jxr-core.js @@ -218,6 +218,7 @@ AFRAME.registerComponent('onreleased', { // changed from ondrop to be coherent w // if multi, should also look for onreleased__ not just onreleased try { eval( code ) // should be jxr too e.g if (txt.match(prefix)) interpretJXR(txt) + // note that event details are avaible within that code as e.detail which might not be very clear } catch (error) { console.error(`Evaluation failed with ${error}`); } @@ -235,6 +236,7 @@ AFRAME.registerComponent('onpicked', { // if multi, should also look for onreleased__ not just onreleased try { eval( code ) // should be jxr too e.g if (txt.match(prefix)) interpretJXR(txt) + // note that event details are avaible within that code as e.detail which might not be very clear } catch (error) { console.error(`Evaluation failed with ${error}`); }