-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Improve pico-controls on third-party browsers such as Wolvic #5534
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,12 +26,12 @@ var PICO_MODEL_GLB_BASE_URL = AFRAME_CDN_ROOT + 'controllers/pico/pico4/'; | |
*/ | ||
var INPUT_MAPPING_WEBXR = { | ||
left: { | ||
axes: {touchpad: [2, 3]}, | ||
buttons: ['trigger', 'squeeze', 'none', 'thumbstick', 'xbutton', 'ybutton'] | ||
axes: {thumbstick: [2, 3]}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do these apply to all the pico controllers? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, in my tests one would not be able to e.g. turn using the blink-controls component and perform gestures with hand-controls without these changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean using wolvic, which advertises the right controller type. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about other browsers? The built-in one? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Pico browser uses the oculus-controls component and behaves as an oculus controller. It was working properly before these changes and keeps doing so afterwards. |
||
buttons: ['trigger', 'grip', 'none', 'thumbstick', 'xbutton', 'ybutton'] | ||
}, | ||
right: { | ||
axes: {touchpad: [2, 3]}, | ||
buttons: ['trigger', 'squeeze', 'none', 'thumbstick', 'abutton', 'bbutton'] | ||
axes: {thumbstick: [2, 3]}, | ||
buttons: ['trigger', 'grip', 'none', 'thumbstick', 'abutton', 'bbutton'] | ||
} | ||
}; | ||
|
||
|
@@ -120,6 +120,7 @@ module.exports.Component = registerComponent('pico-controls', { | |
controller: this.controllerIndex, | ||
orientationOffset: data.orientationOffset | ||
}); | ||
|
||
// Load model. | ||
if (!this.data.model) { return; } | ||
this.el.setAttribute('gltf-model', PICO_MODEL_GLB_BASE_URL + this.data.hand + '.glb'); | ||
|
@@ -163,6 +164,6 @@ module.exports.Component = registerComponent('pico-controls', { | |
}, | ||
|
||
onAxisMoved: function (evt) { | ||
emitIfAxesChanged(this, this.mapping.axes, evt); | ||
emitIfAxesChanged(this, this.mapping[this.data.hand].axes, evt); | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's already a
onControllerConnected
method in the component we should put this logic there.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can, however I need to make sure the adjustment is applied only the first time the event fires, or hands will rotate everytime I put the headset down and come back again later, hence the "once true" on the handler.
Could use a flag to be set once instead... would you prefer something like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
best is probably remove it the rotation on
onControllerDisconnected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tried a different approach: I have now moved the logics to compute the various offsets to the hand model out of the model load handler and into the controller-connected handler.
b0adabf
I have updated the demo links