fernandojsg / aframe-input-mapping-component

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

Splitting up the thumbpad/stick: mapping Vive's touchpad press vs. Oculus's thumbstick push #1

Open ngokevin opened 6 years ago

ngokevin commented 6 years ago

Nice. Would it be possible to support the two different ways that the Vive and Oculus controllers work with the thumb?

On Vive, we touch the touchpad, click the touchpad, and grab the axis value when it was clicked.

On Oculus Touch, we grab the axis value, and see if it's on the threshold for being up/left/right/down.

A-Frame currently doesn't support like thumbpaduppressed or thumbstickup. I wonder if A-Frame should support, or should be handled here.

dmarcos commented 6 years ago

We should probably emit thumpasuppressed and thumbstickup from A-Frame

fernandojsg commented 6 years ago

I agree with @dmarcos, I feel that these events belong to the controllers and not to the mapping, in the mapping we could take these and convert to actions but it doesn't need to interpret the data and generate custom events. Also some people could need these events without using this component. I'm not sure if this is something we should include in any controller's component, or maybe we could have a common function on the tracked-controls that could be called by the controller component and it will emit these events based on the value of the axis.

@SamiraAtMicrosoft added a PR to teleport-controls to emit these events and that was actually what made me start this implementation https://github.com/fernandojsg/aframe-teleport-controls/pull/27

netpro2k commented 6 years ago

I started to explore something like this here https://github.com/robertlong/social-vr-demo/blob/master/src/components/axis-dpad.js

I do agree there should probably be something like this on the raw controllers themselves. I also do think we might need to think of some solution for handling mapping of axes in general.

This also leads to thinking about a non-evented way of querying input state similar to Unity's input API Input.GetAxis, Input.GetButtonDown, etc,

dmarcos commented 6 years ago

@SamiraAtMicrosoft thanks for surfacing the problems and make us think hard on it

dmarcos commented 6 years ago

@netpro2k we have a state API in A-Frame that could be used for that purpose. You could do for instance sceneEl.is('triggerdown')

netpro2k commented 6 years ago

So I went ahead ant tried implementing this here with my existing dpad component, works fine since its just rebraodcating events on the controllers themselves, so its simple to just bind to them.

That said, this brings up a good point about extensibility in general. How should features like this be handled? Opened #2 to start up a discussion on this.

ngokevin commented 6 years ago

Re: getButtonDown: Perhaps would be simple to have a method on the controller components getAxis or getButton so data is returned on demand versus maintained at all times. Versus the state API which has some overhead in needing to maintain with addState/removeState and does not work well with axis values.

machenmusik commented 6 years ago

Unless someone removed it, there definitely should be thumbstickup / down / moved events for touch controllers?

fernandojsg commented 6 years ago

A WIP PR that should fix this issue: https://github.com/fernandojsg/aframe-input-mapping-component/pull/19