playcanvas / engine

JavaScript game engine built on WebGL, WebGPU, WebXR and glTF
https://playcanvas.com
MIT License
9.68k stars 1.36k forks source link

The WebXR AR Basic example look like the cubes are drifting #2441

Open yaustar opened 4 years ago

yaustar commented 4 years ago

https://playcanvas.github.io/#xr/ar-basic.html

Not sure if it's an artifact of them being above the ground. When I tried it, it looked like it wasn't quite grounded in the world.

Maksims commented 4 years ago

Might sound weird, but make sure your camera is clean on mobile (just clean it with cloth from finger oils). And environment is well light with non-solid colors on everything (so it easier to track for AR).

It uses localfloor reference space, which relies on underlying AR system to estimate height above the floor. 0 on Y axis, should be the floor. If that underlying system is unable to estimate properly high above the floor, then different approach can be used, by using local reference space, and asking user to point to the floor and use Hit Test API or other methods to pick floor surface and that way you will find out relative Y difference (floor height).

If things drift around, this is due to underlying AR computer vision issues. AR is not perfect on every device, high end devices get better, but still, drifting is still a thing.

mvaligursky commented 1 year ago

I checked the example code and it places the cubes on the ground, but I agree they're not placed on the ground in the world, but a bit above.