hud-10 (rev2): verify the hand switch with injected synthetic XR input sources

Adds the on-device verification for ADDENDUM 11 and a diagnostics nit
(stats.activeSrc reports '(none)' while no candidate is picked).

There is no official way to fake hand input on a Quest for a WebXR page: Meta's
simulator is a desktop tool for Unity/Unreal native apps, adb has no XR input
injection and CDP has no WebXR domain (WebXR.enable does not exist). So the test
injects synthetic input sources whose targetRaySpace is a real XRRigidTransform
offset reference space of the live session, and drives a press through the real
gamepad path (rising edge on gamepad.buttons[0]) - the same pointerDown(src, frame,
...) the select event reaches. XRSession.prototype.inputSources is overridden for
the test and restored after.

Measured in a live immersive-vr session:
  initial            pointer hand:left  HIT 0.22,0.50
  right press        pointer hand:right HIT 0.78,0.50  activeSrc hand:right
  right release      pointer hand:right HIT 0.78,0.50  (sticky)
  left press         pointer hand:left  HIT 0.22,0.50
  right press, right hand off panel -> pressAt "MISS (not aiming at the panel)"
                                       (did NOT fall back to the left hand's position)
This commit is contained in:
2026-10-12 20:29:51 +08:00
parent 2459b999c6
commit 5eb679f6ca
4 changed files with 53 additions and 5 deletions
+1 -1
View File
@@ -1132,7 +1132,7 @@
if (NS.Controls && NS.Controls.setPointer) {
try { NS.Controls.setPointer(next); } catch (e) {}
}
S.stats.activeSrc = activeSrcKey || '(none)';
S.stats.activeSrc = next.visible ? (activeSrcKey || '(none)') : '(none)';
S.stats.pointer = next.source +
(next.hit ? ' HIT ' + next.hit.nx.toFixed(2) + ',' + next.hit.ny.toFixed(2) : ' (no hit)');
S.stats.inputSources = srcs.map(function (s) {