model-viewer icon indicating copy to clipboard operation
model-viewer copied to clipboard

AR viewer broken in Chrome 144.0

Open AlexandreSoteras opened this issue 9 months ago • 8 comments

Hi!

The AR viewer was working fine on Chrome V143, just updated to V144 and now I can't move the 3D model around the scene. I've been able to reproduce this issue from 2 differents devices (Pixel 9A and Samsung Tab S7).

I'm using the astronaut from the documentation, directly from the page (https://modelviewer.dev/)

Anyone else noticed this?

AlexandreSoteras avatar Feb 09 '26 14:02 AlexandreSoteras

same problem

Strizhko-aa avatar Feb 10 '26 07:02 Strizhko-aa

Yes! I've been having this problem since around 21st Jan. Tested with both Pixel 7A and 8A.

nutmegsoup avatar Feb 10 '26 10:02 nutmegsoup

I got around it by defaulting to scene-viewer but as of today there appears to have been another update which means scene-viewer won't even open D:

nutmegsoup avatar Feb 10 '26 10:02 nutmegsoup

I kind of figured out the issue :

I replaced this :

Before:

this.onSelectStart = (event) => {
    const hitSource = this.transientHitTestSource;
    if (hitSource == null) {
        return;
    }
    const fingers = this.frame.getHitTestResultsForTransientInput(hitSource);
    const scene = this.presentedScene;
    const box = this.placementBox;

    console.log('[AR BUNDLE] fingers in selectstart:', fingers);
    console.log('[AR BUNDLE] fingers.length =', fingers.length);

    if (fingers.length === 1) {
        this.inputSource = event.inputSource;
        const { axes } = this.inputSource.gamepad;
        const hitPosition = box.getHit(this.presentedScene, axes[0], axes[1]);
        box.show = true;
        if (hitPosition != null) {
            this.isTranslating = true;
            this.lastDragPosition.copy(hitPosition);
        }
        else if (this.placeOnWall === false) {
            this.isRotating = true;
            this.lastAngle = axes[0] * ROTATION_RATE;
        }
    }
    else if (fingers.length === 2) {
        box.show = true;
        this.isTwoFingering = true;
        const { separation } = this.fingerPolar(fingers);
        this.firstRatio = separation / scene.pivot.scale.x;
    }
};

with :

console.log('[AR BUNDLE] fingers in selectstart:', fingers);
console.log('[AR BUNDLE] fingers.length =', fingers.length);

// Still enable an interaction even if fingers.length === 0,
// based on the touch position or the current pivot.
this.inputSource = event.inputSource;

let hitPosition = null;

// 1) If at some point fingers has at least 1 element, keep the hit-test logic
if (fingers.length > 0) {
    const finger = fingers[0];
    if (finger.results && finger.results.length > 0) {
        hitPosition = this.getHitPoint(finger.results[0]);
        console.log('[AR JS] hitPosition from hitTest =', hitPosition);
    }
}

// 2) Fallback: use the projected touch position (if available)
if (hitPosition == null && typeof this.getTouchLocation === 'function') {
    hitPosition = this.getTouchLocation();
    console.log('[AR JS] hitPosition from getTouchLocation =', hitPosition);
}

// 3) Final fallback: current position of the scene pivot
if (hitPosition == null && scene && scene.pivot && scene.pivot.position) {
    hitPosition = scene.pivot.position.clone
        ? scene.pivot.position.clone()
        : { x: scene.pivot.position.x, y: scene.pivot.position.y, z: scene.pivot.position.z };
    console.log('[AR JS] hitPosition from pivot =', hitPosition);
}

box.show = true;

if (hitPosition != null) {
    // Main one-finger gesture = translation
    this.isTranslating = true;
    this.isRotating = false;
    this.isTwoFingering = false;

    if (this.lastDragPosition && this.lastDragPosition.copy) {
        this.lastDragPosition.copy(hitPosition);
    } else {
        this.lastDragPosition = hitPosition;
    }

    console.log(
        '[AR JS] -> starting TRANSLATION (even with fingers.length =',
        fingers.length,
        '), lastDragPosition =',
        this.lastDragPosition
    );
} else if (this.placeOnWall === false) {
    // Extreme case: no position, but we can at least enable a basic rotation
    this.isRotating = true;
    this.isTranslating = false;
    this.isTwoFingering = false;
    this.lastAngle = 0;
    console.log('[AR JS] -> starting ROTATION fallback (no hitPosition)');
} else if (fingers.length === 2) {
    // Keep the original two-finger logic if it ever happens
    box.show = true;
    this.isTwoFingering = true;
    const { separation } = this.fingerPolar(fingers);
    this.firstRatio = separation / scene.pivot.scale.x;
    console.log('[AR JS] -> starting TWO-FINGER interaction, firstRatio =', this.firstRatio);
} else {
    console.log('[AR JS] -> no interaction started: no hitPosition and placeOnWall = true');
}

And it's now working again.

It seems that getHitTestResultsForTransientInput keep returning an empty array despite fingers being pressed.

Code has been generated by Copilot so someone will probably do that better :)

AlexandreSoteras avatar Feb 10 '26 11:02 AlexandreSoteras

I have contacted the Chrome team (https://issues.chromium.org/issues/477639547#comment7) and this is a regressing that has been introduced in the browser. The number of "fingers" during the selectstart event triggering is not correctly being handled. They are working on a fix.

Thank you for your suggestion to patch the issue in the interim. Another possible interim solution could be to implement the finger handling logic in the requestAnimationFrame instead of the select events (tested and it works) but right now that would be a significant refactor. We are closely monitoring the Chrome issue with the team to try to get this resolved asap.

judax avatar Feb 10 '26 19:02 judax

Just to confirm, I'm now running Chrome 145.0.7632.120 and this appears to be fixed. I'm able to do 1 finger drag, 2 finger pinch to scale, and 2 finger rotation. Working ok for everyone else?

milesgreen avatar Feb 26 '26 17:02 milesgreen

I confirm the issue is fixed for me on Chrome 145.0.7632.109 on my Pixel 9 Pro. Also #5090 is a duplicate of that issue.

vincentfretin avatar Feb 27 '26 09:02 vincentfretin

FIxed for me too!

AlexandreSoteras avatar Feb 27 '26 14:02 AlexandreSoteras