From 704b60b293ea5467ccd09c960e08788a367e87da Mon Sep 17 00:00:00 2001 From: Fabien Benetou Date: Tue, 21 Mar 2023 19:15:16 +0100 Subject: [PATCH] rotation example, not ideal because not centered on user --- index.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/index.html b/index.html index e6e18c6..84e3f4e 100644 --- a/index.html +++ b/index.html @@ -2396,6 +2396,22 @@ function emptyPinchToMove(){ el.addEventListener('pinchstarted', pinched ); 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() + } }