Conversation
This actually handles the TODO from the original code about not forcing handedness based on the order controllers connect. This code runs for hinted controllers as well, but is a no-op.
This correctly assigns roles at startup for existing devices.
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.
While developing VRInputSpy I was compelled by Valve to test the original Vive wands. These are unique compared to modern controllers in that the left and right hand controller are identical, and they are dynamically assigned the hand that matches the side of the HMD on which they're being held. This means that the role can change at any time from left to right or back, or they can swap positions entirely.
A bit later I also discovered that when switching between hand tracking and controllers on Quest, a similar role reassignment happens and was causing controllers to get lost in the void forever. This is actually a design issue in
XRServer: it removes trackers by name instead of object. By the time we get around to removing them, the new tracker may have already replaced the old one in the server and we accidentally remove the new one instead.This PR handles both of these things by allowing trackers to change roles at any time, and verifying that they are still the active tracker for their role any time we are about to remove them. Trackers which lose their role are renamed to a generic tracker but allowed to remain in the server.
I have not yet filed a bug/PR to fix this behavior in the engine, it's on my TODO list. This workaround will continue to work fine after it's fixed, so this just gives us several versions of backward compatibility. Luckily
XRServer::remove_trackeralready takes a whole object, so the fix will not break the API.