unity-webxr-export icon indicating copy to clipboard operation
unity-webxr-export copied to clipboard

WebXR AR Hit Test

Open De-Panther opened this issue 5 years ago • 11 comments

The current WebXR API doesn't have implementation of plane/surface detection, but it does have Hit Test. To make the AR option useful, need to implement this hit test, so users would be able to position objects in the world.

De-Panther avatar May 16 '20 16:05 De-Panther

With an example scene that allows the user to scale, move and rotate the object, please :D. Ideally, to look something like google's scene viewer

marcusx2 avatar Jul 05 '20 17:07 marcusx2

Hi, what's the status on this? It's trivial to setup in vanilla JS/WebXR, but have there been any hurdles for the layer in Unity?

rogueyoshi avatar Mar 29 '21 18:03 rogueyoshi

@rogueyoshi currently there's Hit-Test with viewer(screen) center only. https://github.com/De-Panther/unity-webxr-export/pull/59

It's possible to implement hit test from other points of the screen, but I prefer to wait for Unity to add support for WebGL in the XR SDK, and implement it after that

De-Panther avatar Mar 29 '21 21:03 De-Panther

@De-Panther well then... will you be PRing this back into the main repo? and do you know when Unity will be making XR SDK bindings?

rogueyoshi avatar Mar 29 '21 23:03 rogueyoshi

I have no idea regarding Unity's plans for XR SDK WebGL support. But once there'll be, I plan to add this to this repo.

If I'll see that it takes them too much time, I'll probably add better support for this specific WebXR API.

Can you describe your use case? (It'll help to design the integration)

De-Panther avatar Mar 29 '21 23:03 De-Panther

Being able to hit test from the center of the screen covers 90% of ordinary use cases, that I can think of. So that's a huge plus. What it omits for now, is the ability for the user to tap certain areas of the screen, and have hit detection fire from that x/y on events such as ontouchstart, ontouchend, etc - this would be useful for stylizing the ux of certain types of ar games and experiences.

imagine a farming simulator where the player wants to plant seeds in the ground. rather than having them direct the center of the screen to each coordinate where they would like to plant the seed, they simply tap the screen, and the seed is planted.

most actual use cases could be engineered around the limitation of only having centered hit testing, but it might be a less fluid ux experience

qbytx avatar Mar 30 '21 00:03 qbytx

I'm struggling to figure out how to use the hit testing implemented here. The sample scene does not seem to do anything despite having the SceneHitTest code present.

ConorVernon avatar Nov 22 '22 13:11 ConorVernon

I have been hassling myself with this package, for the last week, and it's not pleasant to work it on AR, information is scarce, and somewhat quickly written. and the info we have is majorly related to VR.

EDIT : ( I lack the knowledge to talk about this system and i didn't want to confuse anyone, that's why I edited this comment) Thanks for making this incredible plugin available to everyone.

RayznGames avatar May 18 '23 09:05 RayznGames

Please don't confuse others just because you don't know something.

SceneHitTest works as usual, and if you follow the getting started guide it'll work as it should. Combining different versions of parts of projects by copy pasting with no understanding how Unity's assets system works, usually break them, as you describe happened to you.

Documentation is lacking, true. If you must have documentation and can't figure out how to work by using the code and samples, this project is not for you.

De-Panther avatar May 18 '23 11:05 De-Panther

My apologies I wasn't trying to confuse anyone, I may try to improve my understanding of this. I'm sincerely sorry.

RayznGames avatar May 18 '23 22:05 RayznGames