hud-10: the VR pointer follows the hand that is acting or aiming

ADDENDUM 11. With two hands both report a tracked-pointer ray and the runtime's order
is not "the hand the user is using". updatePointer() took the first valid source and
broke, and pointerDown() called updatePointer(frame) without the select event's
inputSource. On device that pinned the guide line/cursor to one hand while the user
aimed with the other, and made the other hand's pinch land wherever the pinned hand
pointed (left hand controlling the click position, right hand clicking).

updatePointer(frame, preferSrc) now builds a candidate per tracked-pointer source and
pickPointerCand() chooses: the acting source, else the last-active source while it is
on the panel, else any source on the panel, else the last-active source, else the
first. pointerDown() passes the event's inputSource, so an action is always evaluated
with the acting hand's ray, and the choice sticks afterwards. stats.activeSrc reports
it; session end resets it.

pickPointerCand is pure and unit-tested against the built bundle (9 cases, including
the reported one: guide on the left + right pinch -> hand:right, and it stays).

Verified in the headset only up to "no hands tracked at the time"; the live hand
switch still needs a worn headset.
This commit is contained in:
2026-10-12 20:22:29 +08:00
parent 22dd482d69
commit 2459b999c6
5 changed files with 193 additions and 24 deletions
+30
View File
@@ -1135,3 +1135,33 @@ side. Debugging that cost more time than the detection itself.
The private cue canvas was read back and OCR'd ("怎么样? 好好地" for cue
"怎么样?好好地"), and injecting/removing a fake `canvas.libassjs-canvas` flips
`subSource` between `libass` and `native` with no errors.
# ADDENDUM 11 — the pointer follows the hand that is acting / aiming
With two hands, BOTH report a `tracked-pointer` ray, and the runtime's order is not
"the hand the user is using". `updatePointer()` took the **first** input source with
a valid ray and `break`ed, and `pointerDown()` called `updatePointer(frame)` without
passing the source from the `select` event. Consequences on device:
- the guide line / cursor stayed pinned to one hand even while the user aimed with
the other (so the guide did not point where they were pointing);
- the other hand's pinch landed **wherever the pinned hand pointed** — the left hand
controlled the click position while the right hand performed the click.
`updatePointer(frame, preferSrc)` now builds a candidate per tracked-pointer source
(with its `panelHit`), and `pickPointerCand()` chooses:
```
1. preferSrc the source acting right now (select / gamepad press)
2. last-active source while it is aiming at the panel (hit.inBounds)
3. any source aiming at the panel (first in runtime order)
4. last-active source (sticky)
5. the first source
```
`pointerDown()` passes the event's `inputSource`, so an action is always evaluated
with the acting hand's ray, and the choice sticks afterwards (`state.stats.activeSrc`).
`pointerUp`/session end reset it.
`pickPointerCand` is pure and unit-tested against the built bundle; the reported case
(guide on the left, right hand pinches) now yields `hand:right` and stays there.