Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add controller immediately to available controllers if inputSource exists already #305

Conversation

kahlstrm
Copy link

@kahlstrm kahlstrm commented Feb 4, 2024

Currently when starting up an application with Oculus Quest 3, the controllers don't come up until you make them disconnect and then reconnect (this means spamming the oculus button a couple of times and returning to the app), which then causes the connected eventListener to trigger.

Crude fix I found working for my case was to check during handler if inputSource already exists for specific id, and then just immediately add to the list of working controllers.

Copy link

codesandbox-ci bot commented Feb 4, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit c6bd3ec:

Sandbox Source
examples Configuration

@kahlstrm
Copy link
Author

kahlstrm commented Feb 4, 2024

This has seemingly broken Controllers-component for me, will try to figure why this is.

@kahlstrm kahlstrm force-pushed the fix/add-controller-input-source-on-startup branch from d74c434 to c6bd3ec Compare February 4, 2024 03:02
@kahlstrm
Copy link
Author

kahlstrm commented Feb 4, 2024

This has seemingly broken Controllers-component for me, will try to figure why this is.

Hmm, never mind? I'm running this locally against my project with npm link ../react-xr and this way the model breaks, but it breaks regardless of this change or not.

@kahlstrm
Copy link
Author

kahlstrm commented Feb 4, 2024

Can confirm that specific bug occurred only due to the npm link behavior, no problems with Controllers if I manually edit the XR.js in node_modules

@CodyJasonBennett
Copy link
Member

Does this app use StrictMode? That might explain the bug or multiple copies of React.

@kahlstrm
Copy link
Author

kahlstrm commented Feb 5, 2024

Yeah I think it's running StrictMode, is it not supported? I can try to remove it and see if I can replicate the bug. I can also try and spin up a small example app

@kahlstrm
Copy link
Author

kahlstrm commented Feb 6, 2024

Hmm, can confirm I don't experience the same behavior with the example app (even though it does have React.StrictMode in index.tsx). Will try to figure out what's wrong with my app.

@kahlstrm
Copy link
Author

kahlstrm commented Feb 6, 2024

Yeah, this was due to us having code that tries to manage if vr is enabled with our own zustand store or not instead of using useXR. This code was not written by me so didn't have a good grasp on what to start debugging by.
Sorry for bothering and thanks for the help!

@kahlstrm kahlstrm closed this Feb 6, 2024
@kahlstrm kahlstrm deleted the fix/add-controller-input-source-on-startup branch February 6, 2024 22:05
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.

None yet

2 participants