Closed fernandojsg closed 6 years ago
This looks good to me.
Actions exist in specific states, so the actions should be in states. Also states might want to have metadata also (imagining what the config UI might look like) so we might want to put actions in an object:
AFRAME.registerInputActions({
default: {
label: "Default State",
actions: {
changeTask: { label: 'Change task' },
testlog: { label: 'Test Log' },
}
},
task1: {
label: "Painting",
actions: {
testlog_task1: { label: 'Test Log Task 1' }
}
}
});
With a corresponding mapping:
AFRAME.registerInputMappings({
default: {
'vive-controls': {
gripdown: 'changeTask',
trackpaddown: 'testlog'
},
'oculus-touch-controls': {
abuttondown: 'changeTask'
triggerdown: 'testlog'
},
'windows-motion-controls': {
gripdown: 'changeTask'
triggerdown: 'testlog'
},
keyboard: {
't_up': 'testlog',
'c_up': 'changeTask'
}
},
task1: {
'vive-controls': {
triggerdown: 'testlog_task1',
gripdown: 'changeTask'
},
'oculus-touch-controls': {
triggerdown: 'testlog_task1',
abuttondown: 'changeTask'
},
'windows-motion-controls': {
triggerdown: 'testlog_task1',
gripdown: 'changeTask'
},
keyboard: {
'y_up': 'testlog_task1',
'c_up': 'changeTask'
}
}
})
@netpro2k yep, I just forgot to include them on the example. I created a PR with the proposals https://github.com/fernandojsg/aframe-input-mapping-component/pull/17
actions
should defined set in a different way, and it will be always specified by the application as it will contains the list of actions that the app will be listen for.mappings
will contain mappings between hardware events and theactions
defined by the app. These mappings could be specified initially by the app as a default mapping, but they could eventually be generated by the user manually or using a common UI for a-frame (As steam does), or by fetching configurations remotely.Right now we have:
And we call:
The proposed change will be to take
actions
out from these mappings and create another function to set them: