Behaviour of DragControls in AR scenarios - horizontal movement

So I edited DragControls.ts to quickly test a purely horizontal drag (by setting wp.y = 0 in onUpdateWorldPosition). On desktop this works great, model can’t be dragged vertical, but in AR on Android Chrome the model seems to move with the phone when I drag it around. See clip

Original Post on Discord

by user 103054507105067008

With dragcontrols it behaves in AR same as with using VR with WebXR controllers - it attaches to the controller

and in AR a touch is a controller with selection events

It is a cool behaviour I think, one I might make optional for AR as I think that I could use that as a drag feature but I’m going to add a default horizontal only movement. I’ll have a closer look at the code in that case!

by user 103054507105067008

You could disable the drag controlls when entering AR maybe and add your own touch logic using screenspace events

I’m making a customised version of the script but it took me a while to figure out what’s going on in the script

by user 103054507105067008

you can still use the normal browser touchstart etc events

I’ll share back what I make for samples for AR I think!

by user 103054507105067008

Ok - not sure if that’s easier than creating a new one to be honest

If i understand correctly you just need to detect “touchstart” and the respective events + perform a raycast to check if you hit your object and then apply your gesture code to that model

Only because I like the behaviour of yours but I know most of the time when I do AR I need horizontal drags

by user 103054507105067008

just for AR

horizontal drag only?

on a plane only?

Yeah just to move an AR project around on a plane, I’ll follow your advice and do a fresh one

by user 103054507105067008


by user 103054507105067008

Maybe @Adoran can share his version here - if I remember correctly he did something similar (horizontal drag + raycasting onto underlaying terrain) for a project :slightly_smiling_face:

Changed the channel name: Behaviour of DragControls in AR scenarios - horizontal movement

Hopefully others can share so I can help!

by user 103054507105067008

Was just reading when you deleted the message ^^