AR object position drifts with phone's horizontal motion

Catching up with the latest AR support, I find that a loaded model appears stationary relative to camera rotation but drifts with the camera position on horizontal motion of the phone. What am I doing wrong? Using a Pixel 4XL - is it a hardware limitation? It should have a 3-axis accelerometer.

Does this work correctly for anyone else?

There appear to be precious few AR demos out there still, everything is VR-centric.

EDIT: Ive also tried various cameras (FreeCamera, UniversalCamera, DeviceOrientationCamera), all behaving the same.

And Ive tried all referenceSpaceTypes. From my reading, unbounded ought to work but in fact the object still pans with the camera with only rotation working as expected.

This is my initialization:

var camera = new DeviceOrientationCamera("camera1", new Vector3( 10, 10, 10 ), newScene);
const xrHelper = await newScene.createDefaultXRExperienceAsync(
    { uiOptions: {
        sessionMode: "immersive-ar",
        referenceSpaceType: "unbounded",
        optionalFeatures: []
    } }
);

cc @RaananW

Found it! My bad. But I want to leave the answer here in case anyone else makes my mistake.

Turns out the lack of position tracking is an optical illusion. Like driving down the highway, and the far distance background appears to follow along with you. Mountains, cities, etc. But you expect this - they are enormous and distant.

    xrHelper.baseExperience.sessionManager.worldScalingFactor = 4;

https://doc.babylonjs.com/features/featuresDeepDive/webXR/webXRSessionManagers

An arbitrary value, but position tracking as I move around my model, now makes sense visually. So position tracking was always working. But in AR, without any depth data on the passthru background, position tracking may appear broken at the wrong world scale.

3 Likes