fernandojsg / aframe-input-mapping-component

https://fernandojsg.github.io/aframe-input-mapping-component
MIT License
24 stars 7 forks source link

Specify the hand #12

Closed fernandojsg closed 6 years ago

fernandojsg commented 6 years ago

As initially @dmarcos proposed on https://github.com/fernandojsg/aframe-input-mapping-component/issues/3#issuecomment-338308387

If we don't specify hand (object) it will just apply that action to both hands:

 common: {
    dpaddown: snaprotateleft
}

Both hands it will apply each action to each hand:

 common: {
    dpaddown: { left: "snaprotateleft", right: "snaprotateright" }
}

Just one hand, it will apply the specific action to one hand and the other won't have any action (Unless we'll rewrite it in controller' specific section:

 common: {
    dpaddown: { left: "snaprotateleft" }
}
netpro2k commented 6 years ago

Hmm, hand is a property of the input device, not the input event or the action, seems like it should be included with the input device somehow. Maye use something like attribute selector syntax:

{
  "vive-controls[hand='left']": { ... }, // binds only to events on vive-controls components with hand property set to left
  "vive-controls[hand='right": { ... } // binds only to events on vive-controls components with hand property set to right
  "vive-controls": { ... } // binds to any event on a vive-controls component
}

This prevents us from hardcoding the idea of handedness and just gives us the ability to more selectively filter the event sources we are binding to.

fernandojsg commented 6 years ago

Yep initially my first thought was about doing something on the left side like vive-controls@left but I like more the idea of having a attribute filter just in case that we'll have any other attributes ni the futures intead of just handedness. What do you think @dmarcos ?

dmarcos commented 6 years ago

I do not think creating a DSL is not a good way to go. You have to document, parse, handle errors, there’s a learning curve and it is ugly 🙂. What other attributes you see besides handennes?

fernandojsg commented 6 years ago

Implemented on https://github.com/fernandojsg/aframe-input-mapping-component/pull/18