Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

Implementing the GamePad controller for react360 #650

Closed
drubio1989 opened this issue Jan 15, 2019 · 2 comments
Closed

Implementing the GamePad controller for react360 #650

drubio1989 opened this issue Jan 15, 2019 · 2 comments

Comments

@drubio1989
Copy link

drubio1989 commented Jan 15, 2019

I had a question regarding the GamePad controllers for react 360 and as to how it can be implemented. I've been experimenting with a SimpleGaze reticle and have a decent understanding of how to use the inputs. In the following file found here, is this an example GameControllerRayCaster for immediate use or is this just an example piece of code for guidance? GameControllerRayCaster.

Also in the documentation, I read that Input Handling can support out of the box an Xbox, Oculus Go, Oculus Touch, and Microsoft Mixed Reality controllers. However, in this piece of code, I found what looks to be more support for a variety of different controllers:

        [const WELL_KNOWN_MAPPINGS = {
        // Gear VR HMD Touchpad
        'Gear VR Touchpad': ['confirm'],
        // Gear VR Controller
       'Gear VR Controller': ['confirm', 'confirm'],
       // Oculus Go Controller
       'Oculus Go Controller': ['confirm', 'confirm'],
       // Daydream Controller
       'Daydream Controller': ['confirm'],
       // Oculus Touch
       'Oculus Touch (Left)': MAPPING_SHARED_TOUCH,
       'Oculus Touch (Right)': MAPPING_SHARED_TOUCH,
        // Standard MS Mixed Reality
         'Spatial Controller (Spatial Interaction Source) 045E-065B': MAPPING_SHARED_MSMR,
        // Samsung Odyssey
       'Spatial Controller (Spatial Interaction Source) 045E-065D': MAPPING_SHARED_MSMR,
       // TODO: Vive Wand mapping
       };](url)

I can't tell between the documentation and the actual code if an xbox controller is supported (which is what I want). Can someone help clarify this for me. In addition, is the onInput handler the only thing that I need to support the xboxcontroller?

@larrylin28
Copy link
Contributor

In general, this mapping is to try converting the mapping of gamepad key id to button class used by React360. Those in the map are well known gamepad mappings. If the gamepad name doesn't match those, it will fallback to a standard mapping, which is the mapping for PS/XBOX controller. So for your question, xbox controller is supported because it's the standard mapping.
And for additional question, yes, onInput is the event sent to the view when cursor is pointing to the view and any key event happens on the gamepad. It will provide the button class provided by the mapping, it will also provide the original key id if you want to process your own gamepad input logic. If you just want basic input like "click", you can just use which will provide a onClick event.

@drubio1989
Copy link
Author

@larrylin28 Thanks for this clarification, I appreciate it. This helps me get things moving.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants