billboarding example

gesture-manager
Fabien Benetou 4 months ago
parent 7d4c06ac09
commit 4fc9c0cddb
  1. 3
      index.html
  2. 5
      jxr-core.js

@ -76,8 +76,8 @@ AFRAME.registerComponent('selector-line', {
}, },
// try pinching modifier, e.g pinch while holding the SHIFT key // try pinching modifier, e.g pinch while holding the SHIFT key
}) })
</script> </script>
<a-scene startfunctions> <a-scene startfunctions>
<!-- City Scene Sketch by Alex Safayan [CC-BY] via Poly Pizza --> <!-- City Scene Sketch by Alex Safayan [CC-BY] via Poly Pizza -->
@ -104,6 +104,7 @@ AFRAME.registerComponent('selector-line', {
<a-troika-text anchor=left target id="listboundgestures" value="jxr listBoundGestures()" position="0 1.40 -0.4" scale="0.1 0.1 0.1"></a-troika-text> <a-troika-text anchor=left target id="listboundgestures" value="jxr listBoundGestures()" position="0 1.40 -0.4" scale="0.1 0.1 0.1"></a-troika-text>
<a-troika-text anchor=left target id="switchside" value="jxr switchSide()" position="0 1.35 -0.4" scale="0.1 0.1 0.3"></a-troika-text> <a-troika-text anchor=left target id="switchside" value="jxr switchSide()" position="0 1.35 -0.4" scale="0.1 0.1 0.3"></a-troika-text>
<a-troika-text anchor=left target id="togglebillboarding" value="jxr toggleBillboarding()" position="0 1.55 -0.4" scale="0.1 0.1 0.3"></a-troika-text>
<a-troika-text anchor=left target id="locationreload" value="jxr location.reload()" position="0 1.20 -0.4" scale="0.1 0.1 0.1"></a-troika-text> <a-troika-text anchor=left target id="locationreload" value="jxr location.reload()" position="0 1.20 -0.4" scale="0.1 0.1 0.1"></a-troika-text>
<a-troika-text anchor=left target id="makeAnchorsVisibleOnTargets" value="jxr makeAnchorsVisibleOnTargets()" position="0 1.05 -0.4" scale="0.1 0.1 0.1"></a-troika-text> <a-troika-text anchor=left target id="makeAnchorsVisibleOnTargets" value="jxr makeAnchorsVisibleOnTargets()" position="0 1.05 -0.4" scale="0.1 0.1 0.1"></a-troika-text>

@ -25,6 +25,7 @@ const sides = ["right", "left"]
var pinches = [] // position, timestamp, primary vs secondary var pinches = [] // position, timestamp, primary vs secondary
var dl2p = null // from distanceLastTwoPinches var dl2p = null // from distanceLastTwoPinches
var selectedElements = []; var selectedElements = [];
var billboarding = false
// ==================================== picking ====================================================== // ==================================== picking ======================================================
@ -161,7 +162,7 @@ AFRAME.registerComponent('pinchprimary', { // currently only 1 hand, the right o
if (selectedElement){ if (selectedElement){
let content = selectedElement.getAttribute("value") let content = selectedElement.getAttribute("value")
selectedElement.emit('released', {element:selectedElement, timestamp:Date.now(), primary:true}) selectedElement.emit('released', {element:selectedElement, timestamp:Date.now(), primary:true})
// selectedElement.object3D.rotation.set( 0, 0, 0 ) // billboarding, could need modifier if (billboarding) selectedElement.object3D.rotation.set( 0, 0, 0 )
} }
// unselect current target if any // unselect current target if any
selectedElement = null; selectedElement = null;
@ -833,6 +834,8 @@ function addDropZone(position="0 1.4 -0.6", callback=setFeedbackHUD, radius=0.11
return el return el
} }
function toggleBillboarding(){ billboarding=!billboarding }
// ==================================== facilitating debugging ====================================================== // ==================================== facilitating debugging ======================================================
function makeAnchorsVisibleOnTargets(){ function makeAnchorsVisibleOnTargets(){

Loading…
Cancel
Save