rotation example, not ideal because not centered on user

motionstick
Fabien Benetou 2 years ago
parent 834ffb4091
commit 704b60b293
  1. 16
      index.html

@ -2396,6 +2396,22 @@ function emptyPinchToMove(){
el.addEventListener('pinchstarted', pinched ); el.addEventListener('pinchstarted', pinched );
function pinched(event){ function pinched(event){
} }
let previousPositionSecondary
let elSecondary = document.querySelector('[pinchsecondary]')
elSecondary.addEventListener('pinchmoved', movedSecondary );
function movedSecondary(event){
if (selectedElement) return
if (previousPositionSecondary){
angle = previousPositionSecondary.sub(event.detail.position).clone()
applyToClass("hidableenvironment", (e, val ) => {
let rot = e.getAttribute("rotation")
e.setAttribute("rotation", ""+rot.x+" "+(rot.y+val*90)+" "+rot.z)
// rotating from the center of the model, not the player position
}, angle.x)
}
previousPositionSecondary = event.detail.position.clone()
}
} }
</script> </script>

Loading…
Cancel
Save