Closed soadzoor closed 5 years ago
Looks like this is not yet implemented in the polyfill. I see inputsourceschange
in the explainer, but not the actual spec -- @toji should this be implemented here?
So this event should be added to the spec, submitted: https://github.com/immersive-web/webxr/pull/395
I want to go with inputsourceschange
event support for #81
I'm thinking how to implement. As I mentioned in #81, inputSources are set up in animation frame (more precisely, onFrameStart()
). So, perhaps easiest solution may be replacing
this[PRIVATE].device.onFrameStart(this[PRIVATE].id);
callback(now(), this[PRIVATE].frame);
this[PRIVATE].device.onFrameEnd(this[PRIVATE].id);
https://github.com/immersive-web/webxr-polyfill/blob/master/src/api/XRSession.js#L295-L297
with something like this
this[PRIVATE].device.onFrameStart(this[PRIVATE].id);
const newInputSources = this.inputSources;
const previousInputSources = this[PRIVATE].previousInputSources;
// Here, compare inputSources with previous frame's ones
// and fire inputsourceschange event if different.
this[PRIVATE].previousInputSources = newInputSources;
callback(now(), this[PRIVATE].frame);
this[PRIVATE].device.onFrameEnd(this[PRIVATE].id);
What do you think?
SGTM!
I think this issue can be closed because of #91
Agreed.
Hi,
I created a quick mockup about the issue in the title, you can find it here: https://vrtual.house/development/webxr-polyfill-test/
The problem: I cannot make any interaction on the scene, when the WebXR flag is disabled, and the polyfill is used. In three.js, there are some events for interaction, like
selectstart
, andselectend
, but they're not dispatched when the polyfill is used, only when the flag is set to enabled.I guess it has something to do with the fact that the
inputsourceschange
isn't fired either when the polyfill is used. (You can find the lines in question starting from line21752
in the three.js r96 build):