Skip to content

Dynamic tracker roles - #182

Open
vilhalmer wants to merge 4 commits into
GodotVR:masterfrom
liminetics:dynamic-tracker-roles
Open

vilhalmer wants to merge 4 commits into
GodotVR:masterfrom
liminetics:dynamic-tracker-roles

Conversation

@vilhalmer

Copy link
Copy Markdown
Collaborator

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_tracker already takes a whole object, so the fix will not break the API.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vive wands left and right mixup

1 participant