diff --git a/index.html b/index.html index 8161d3b..41b010a 100644 --- a/index.html +++ b/index.html @@ -90,8 +90,9 @@ warning that selectedElement will get overwritten once executing a command by pi */ // motivated by https://git.benetou.fr/utopiah/text-code-xr-engine/issues/63 -var reserved-keywords = ["selectedElement", "lastPointSketch ", "commandhistory", "groupSelection", "targets"] -// see generated file reserved-keywords for more +var reservedKeywords = ["selectedElement", "lastPointSketch ", "commandhistory", "groupSelection", "targets", "observe", "sa", "qs"] +// see generated file reserved-keywords for more yet not sufficient, see instead parseJXR() +// should also include some documentation const prefix = /^jxr / const codeFontColor = "lightgrey" @@ -785,6 +786,24 @@ function setHUD(txt){ document.querySelector("#typinghud").setAttribute("value",txt) } +AFRAME.registerComponent('waistattach',{ + schema: { + target: {type: 'selectorAll'}, + }, + init: function () { + var el = this.el + this.worldPosition=new THREE.Vector3(); + }, + tick: function () { + var worldPosition=this.worldPosition; + worldPosition.copy(this.el.object3D.position);this.el.object3D.parent.updateMatrixWorld();this.el.object3D.parent.localToWorld(worldPosition) + Array.from( this.data.target ).map( t => { + t.object3D.position.x = worldPosition.x + t.object3D.position.z = worldPosition.z + }) + }, +}); + AFRAME.registerComponent('wristattachsecondary',{ schema: { target: {type: 'selector'}, @@ -1196,8 +1215,10 @@ function saveHistoryAsCompoundSnippet(){ } function bindVariableValueToNewNote(variableName){ + // from observe jxr keyword const idName = "bindVariableValueToNewNote"+variableName addNewNote( variableName + ":" + eval(variableName), `-0.15 1.4 -0.1`, "0.1 0.1 0.1", idName, "observers", "true" ) + // could add to the HUD instead and have a list of these return setInterval( _ => { const value = variableName+";"+eval(variableName) // not ideal for DOM elements, could have shortcuts for at least a-text with properties, e.g value or position @@ -1591,7 +1612,7 @@ function switchSide(){ --> + hud camera look-controls wasd-controls waistattach="target: .movebypinch" position="0 1.6 0"> + + + + + + + +