Fix Quest controller input and reconnect crash - #25
Merged
Conversation
…ks, reconnect crash Controllers streamed from a Quest client were unusable by OpenXR apps: they never appeared in Unity at all, the models rendered visibly tilted, grip never registered a press, and taking the headset off and on crashed the client. Interaction profiles - xrGetCurrentInteractionProfile reported a device-specific profile the app had never suggested bindings for (e.g. meta/touch_controller_quest_2). The spec requires a profile the app actually bound, or XR_NULL_PATH, so report the first entry of the compatibility list the app suggested bindings for. Input was already routed through that same list. - Emit XrEventDataInteractionProfileChanged, which was never sent at all. An app queries the current profile once at startup - before any headset has connected - caches "no controller" and never asks again, so controllers that became active later stayed invisible. The profile is now re-resolved each xrSyncActions and the event pushed when it changes. Poses - Serve /input/aim/pose from a distinct streamed aim pose instead of reusing the grip pose. Games place the controller model and ray from aim, which sits 45-60 degrees away from grip on Touch, which is what made controllers look rotated. The Quest client already computed the aim pose and now sends it. Buttons - Threshold squeeze/value and trigger/value for boolean actions. The oculus/touch profile has no squeeze/click - grip is analog-only - so a boolean grip action bound to the value path always read false and grip never clicked. Protocol - The aim pose fields are appended to TrackingPacket, and the receiver accepts packets down to the pre-aim size and zero-fills the rest, so existing clients keep working and a missing aim pose falls back to the grip pose. Protocol.swift is updated in step because the packet is sent as a raw struct copy, and the layout test pins the new size and field offsets. Quest client - Fix a SIGSEGV on reconnect. The client applied the server's foveation preset on the discovery thread, racing the render thread's session teardown inside the Meta VR driver. Applying it is deferred to RunFrame and made idempotent, so an unchanged preset no longer tears down and rebuilds a live foveation profile. Runtime test suite passes (480 assertions).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to issue #6
Controllers streamed from a Quest client were unusable by OpenXR apps that were using meta/oculus input profiles: they never appeared in Unity at all, the models rendered visibly tilted, grip never registered a press, and taking the headset off and on crashed the client.
Interaction profiles
Poses
Buttons
Protocol
Quest client
Testing
Meta Quest 2 hardware streaming from a Mac M5 Pro, same unity project settings as on a windows machine.