AR Display and surface tracking

I’m looking to display an AR cube on android and IOS devices with surface tracking before display, I guess it’s relatively simple to set up but using Needle for a few hours I have no idea how to organize my project on unity to get this done. If someone would be so kind as to help me :slightly_smiling_face:

Original Post on Discord

by user 529307655622230016

Hey :wave: you can look into samples to see how that is done.

For example a good example is the Musical Instruments sample: https://engine.needle.tools/samples/musical-instrument/?room=needle291

Search for it in the samples window and see what components are needed.

The AR/VR docs list and describe all the XR components that you can use: https://engine.needle.tools/docs/xr.html#adding-vr-and-ar-capabilities-to-a-scene

In your case that would be:

  • WebXR
  • USDZ Exporter
  • WebARSessionRoot

Anything that you place under WebARSessionRoot will get exported, you can place it right next to the Gtlf Object and see the whole scene in AR like that.

Mind that iOS does support only USDZ file viewing and not the full WebXR standard. To understand what is possible, checkout the Everywhere Actions and see their samples and enter the AR on an iPhone.

Thank you so much for the documentation and advice, I was able to successfully display my cube !

by user 529307655622230016

Let us know if you would get stuck again :cactus:

Hi, I have another problem displaying my object on android devices, on IOS everything is displayed correctly (left screenshot) but on android with google browser there is only a little cube displayed that I never created (right screenshot). I’ve added the following components to my root gameObject : Gltf Object, USDZ Exporter, Web XR, Web AR Session Root, Web XR Plane Tracking


by user 529307655622230016

Are there any android extensions I forgot to add maybe ?

by user 529307655622230016

There’s currently a bug in Chrome where the scene is sometimes rotated shortly after placing it (Chrome devs are looking into it as far as I’m aware), can you check that the content isn’t somewhere to the side?

That green cube is from the default avatar, you can remove the DefaultAvatar reference in the WebXR component

The issue in chromium can be found here if you want to keep track of their progress: https://bugs.chromium.org/p/chromium/issues/detail?id=1475680

Hi @albendo we’re adding a fix on our side in engine to workaround the underlying bug - the next update should work as expected again on android as well

Hi @herbst🌵 @marwie1 :cactus: , indeed as stated in the Chrome bug report after several seconds or minutes and turning the phone the scene finally appears

by user 529307655622230016

@albendo can you try if version 3.19.1 fixes the issue for you?

I’ll test it

by user 529307655622230016

seems to be fixed for me :ok_hand:

by user 529307655622230016