immersive-web / webxr-hand-input

A feature repo for working on hand input support in WebXR. Feature lead: Manish Goregaokar
https://immersive-web.github.io/webxr-hand-input/
Other
105 stars 17 forks source link

Allow creating a WebXRHand instance without a controller #79

Closed AmitMY closed 3 years ago

AmitMY commented 3 years ago

The only docs I found how to construct a WebXRHand are here. I could not find how to access this class from navigator.xr.

My use case:

I'm looking for a way to create a WebXRHand object from pose estimated using a webcam. I'm basically trying to extend this application to support webcam input in addition to VR headsets.

For every frame from the camera, I have 3D coordinates for all 25 joints per hand, and all I need now is to create each hand as a WebXRHand object in order to apply some normalization like they do with a VR headset input.

Concrete question:

Should there be a way to construct WebXR hand instance in the browser, by using the joints positions, without the controller?

Manishearth commented 3 years ago

The WebXR API basically doesn't allow plugging in this way for any part of the API.

You should build this as something that will behave like a polyfill. You can potentially use offset reference spaces here so that it integrates well with the rest of the API, though that does lead to a lot of allocations.

AmitMY commented 3 years ago

Thanks, @Manishearth. I'm not sure I fully understand this yet. Could you perhaps direct me to where I could learn how to do such a thing? I know I could just create a class, call it WebXRHand and define the hand parts, but I would like it to indeed play nicely with the rest of the API, so at the very least it could be multiplied and have the correct shape (where every joint has a position, a matrix, etc...)

Manishearth commented 3 years ago

There aren't really any resources for doing this kind of thing, though this spec is a good resource for polyfilling the hand API since that's just another implementation. The core issue you'll have is that the XRSpace APIs will not work.

I think you'll have to just modify the application to do XRSpace operations in a way that hook in to your custom spaces as well.