Is polling used to fetch controller button state?

The author of lovr stated, “OpenXR don’t provide an event-based means of checking for input, you can only poll for input”. Is this accurate? If so, is there any plan to move to (faster) event-based?

github issue: callback for button presses like lovr.keypressed? · Issue #477 · bjornbytes/lovr · GitHub.

This is correct. “faster” is not necessarily the issue here - the polling/state check model doesn’t introduce unnecessary latency. The state is only updated (“polled”) when you call xrSyncActions so that you have a consistent, atomic picture of all inputs (other than pose inputs). You also get timestamps for changes in inputs, so you can request pose data for the change time (so you know when the “grab” button was released, and what the velocity was to impart to the held object, etc).

Folks will sometimes bring up event-style input handling, since this model theoretically means you might miss a button press/cycle, but in practice I haven’t heard of any cases in which this model doesn’t work.

That said, just because OpenXR doesn’t provide events/callbacks, doesn’t mean you can’t provide one in an engine or wrapper around OpenXR: that’s what “changedSinceLastSync” in is provided for. At xrSyncActions time, get the action state, and if changedSinceLastSync is true, fire the callback.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.