I have a nice WebXR application where we show a marker on scene start, and when the user taps the screen we place a model.
I use WebXRHitTest for getting a hittest (pose) of the physical floor, and I attach the model with WebXRAnchorSystem.
Now we would like enable the use to drag the model along the detected plane. And I’m not sure how to this properly.
For instance is it possible to use WebXRHitTest to get a floor pose from a defined ray?
Or is there another way to implement this?
A hit test result provides you with the transformation to place an object right on the plane, which technically means you can the plane’s direction in space. Dragging along a plane using hit-test is possible, but you will need to detach it from the anchor before “picking” it and create a new one after.
I never thought of the possibility to run more than one hit-test request per frame. it might slow down your application.
The two states do feel like they are not really running in parallel, so I don’t see why you would need two hit tests. What I mean is - when nothing is selected, keep the configuration you have there, and when an object is selected, change the configuration to match the use-case (which I assume will also require changing the offset ray (the transient offset ray to be exact) in realtime.