IVRInput: 1-frame input drop (bActive = false) after lowering action set nPriority while input is held

Aperta
#1,932 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
18/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Attiva
Stack tecnologico
cpp
Ambito
api

Direzione di ricerca

The payload names no source files. The entry points are IVRInput::UpdateActionState and GetAnalogActionData, and the priority field is VRActiveActionSet_t::nPriority. Reproducing needs SteamVR, a controller and an overlay app, so start by checking whether the one-frame bActive == false gap happens with other headsets. The issue does not say what to change: the reporter asks whether the gap is intended and whether it should be fixed or documented. Done would mean a maintainer decision plus either a corrected input path or documentation of the gap.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

I'm writing an overlay application that uses IVRInput. While the pointer is on one of its overlays, it raises the priority of the trigger action set for that hand to vr::k_nActionSetOverlayGlobalPriorityMin (so the game doesn't receive the trigger). When the pointer leaves, it lowers the priority back to 0.

When the priority is lowered while the trigger is still physically held, the next GetAnalogActionData call for the trigger returns VRInputError_None with bActive == false and x == 0 for exactly one frame. On the following frame it returns bActive == true with the real value again.

An application that treats "inactive" as "0" sees a release followed immediately by a new press, although the user never released the trigger.

Raising the priority (0 → global overlay priority) did not show this in my logs.

Environment

  • SteamVR version: SteamVR 2.17.10
  • OS: Windows 11
  • Headset / controllers: Meta Quest 2, connected through Virtual Desktop (Touch controllers)
  • Input: IVRInput with a custom action manifest; the trigger is a vector1 action in its own action set (one action set per input group, each activated per hand with ulRestrictedToDevice = /user/hand/right etc.)
  • SteamVR's setting that allows overlay apps to take input priority is enabled:

What the app does each frame

// sets[] contains one VRActiveActionSet_t per (action set, hand).
// For the trigger set of the right hand:
sets[i].ulActionSet          = triggerSet;
sets[i].ulRestrictedToDevice = rightHandSource;
sets[i].nPriority            = blocked ? vr::k_nActionSetOverlayGlobalPriorityMin : 0;

vr::VRInput()->UpdateActionState(sets, sizeof(sets[0]), count);

vr::InputAnalogActionData_t d{};
vr::VRInput()->GetAnalogActionData(triggerAction, &d, sizeof(d), vr::k_ulInvalidInputValueHandle);
// d.bActive, d.x are used as the trigger value

blocked becomes true while the ray is on one of our overlays and false when it is not (or when the overlay under the ray is destroyed).

Observed log

f is my frame counter (one UpdateActionState + one read per frame), t is milliseconds. block lines are printed when I change nPriority for the trigger set (it takes effect on the next UpdateActionState). trigger input lines are printed when bActive changes.

f=1198 block   trigger=0 (before: trigger=1)       t=16060   <- priority lowered while the trigger is held
f=1199 trigger input active=0 (error=0, bActive=0, value=0.00)  t=16082   <- one frame, no data
f=1199 block   trigger=1 (before: trigger=0)       t=16085   <- (my app raised it again)
f=1200 trigger input active=1 (error=0, bActive=1, value=0.74)  t=16102   <- real value is back

The same pattern appeared every time the priority was lowered while the trigger was held (3 of 3 cases):

priority lowered at bActive == false at bActive == true again at
f=1198 f=1199 f=1200 (0.74)
f=1226 f=1227 f=1228
f=1282 f=1283 f=1284 (0.85)

Raising the priority (f=1255, trigger not held) was followed by no bActive change. The frame interval is about 16 ms.

Expected behavior

One of:

  1. bActive stays true and the held value keeps being reported across the priority change; or
  2. If a one-frame gap is expected, it should be documented (for UpdateActionState / VRActiveActionSet_t::nPriority), together with the recommended way to tell it apart from a real release.

Actual behavior

For one frame after the priority is lowered, bActive == false and x == 0, even though the trigger is held and the call returns VRInputError_None.

Impact

The app sees "trigger 0.61 → 0.00 → 0.74": a release and a new press within two frames, which a human cannot do. In my case a click on a button that disappears (so the ray ends up on another overlay behind it) was delivered twice, and the second one clicked the overlay behind it.

Workaround

When bActive is false, keep the previous value for up to 3 frames, then fall back to 0.

Questions

  • Is this gap intended when nPriority is lowered? Is it specific to this priority transition (global overlay priority → 0)?
  • Is there a recommended way to avoid it (for example, delaying the priority change until the input is released, or reading the data with a specific ulRestrictedToDevice)?

Notes / what I have not verified

  • I only tested Quest 2 through Virtual Desktop. I don't know whether it also happens with a native SteamVR headset or other controllers.
  • In one earlier run with the input-priority setting turned off, I saw a similar 0.00 → 0.94 jump, but that build had no bActive logging, so I can't say whether bActive was false there.
Lingua principale
C++
Stelle
6.7k
Fork
1.3k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ValveSoftware/openvr

Tutte le issue di ValveSoftware/openvr

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.