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

Motion controller device ID #8

Closed
leweaver opened this issue Oct 13, 2017 · 1 comment
Closed

Motion controller device ID #8

leweaver opened this issue Oct 13, 2017 · 1 comment

Comments

@leweaver
Copy link

leweaver commented Oct 13, 2017

'Spatial Controller (Spatial Interaction Source) 045E-065B': {

A few things :)

Firstly - we refer to the current in-market devices as "Windows motion controllers". In terms of naming convention, I would suggest 'motion controllers'.

It is unfortunately not possible to do an exact string match on device ID - the last section (045E-065B) will vary based on the specific connected device. As an example: if you use the Simulator, the controllers will actually come through as:

Spatial Controller (Spatial Interaction Source) 00FF-FF00

We recommend doing a string startsWith test for: 'Spatial Controller (Spatial Interaction Source) ' to determine that the device is a motion controller to choose button mappings.

The next piece of the puzzle is support for the devices pointing ray direction and position offset. You may notice that the device pose does not accurately reflect where you are pointing (this is similar to Oculus Touch controllers). You can really see this if you compare the pointing ray from the VRController to that in the Mixed Reality cliffhouse.

To make matters a bit more complicated - the ray offset and direction actually vary depending on what kind of motion controller is plugged in connected - which is discernable by looking at the code portion of the device ID. As an example, you can use the following regex to get the device code:

/([0-9a-zA-Z]+-[0-9a-zA-Z]+)$/

There are currently 2 distinct devices supported by Windows Mixed Reality, each having a slightly different form factor and pointing direction. (They have the same button mappings). GLB (binary glTF) files of these two devices are available at this fork of the a-frame assets repository:
https://github.com/leweaver/assets/tree/msft/new-controller-model/controllers/microsoft

The pointing pose offset can actually be found in those glTF files, on the node named POINTING_POSE. That node is transformed such that it faces outward in the direction of the pointing pose. It is a local transform, so an attached line would be oriented correctly (ie, it relies on the transform accumulation of the parent nodes).

Happy to provide more info!
Lewis

@stewdio
Copy link
Owner

stewdio commented Oct 15, 2017

Hi Lewis—thanks for investigating this and providing so much info! I see what you mean about the Gamepad id string. I’ve just updated my code to find the appropriate support object using startsWith() instead of a direct object property access. Do you think in the future the Gamepad API might support multiple properties for this? Like a main ID, then subversion strings? Make, model, year, version number... That sort of thing?

As for preferring to call these “Windows motion controllers” I see what you mean there. But the “style” string that I assign is meant to be an extreme shorthand to make distinguishing between supported controllers more convenient. For example one might write if( controller.style === 'microsoft' )... Brevity and clarity. (As second-generation VR rigs hit the market I may have to expand upon this, but I’ll wait to see what the landscape is before adding additional bits.)

I’ll take a closer look at the pointing pose—that’s an interesting distinction I hadn’t considered. Perhaps even worth making a new issue out of; I could revisit the pointing poses of all supported controllers.

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

No branches or pull requests

2 participants