dataarts / dat.guiVR

A flexible graphical user interface for changing variables within WebVR.
https://workshop.chromeexperiments.com/examples/guiVR/
Apache License 2.0
311 stars 50 forks source link

Hopefully fix dual-wielding #47. #85

Closed xinaesthete closed 7 years ago

xinaesthete commented 7 years ago

I was finding that the confusion between events from different controllers was not sufficiently edge case to ignore. We'd been using only one controller for dat.GUIVR but it would often only respond to buttons on the other controller, seemingly dependent on the order they were activated (so you had to point with one hand and press the trigger on the other).

Under certain circumstances (in the example programs from the repo), button presses from a controller pointing at one object trigger events from the object that the other controller is pointed at. I'm not entirely sure if that is exactly the same issue.

I've been testing with the shredder example, focusing on the latter problem for now. I don't think I can see any problems with the behaviour as it stands with this minor change, but I'll do some more testing.

mflux commented 7 years ago

Thanks again for the PR, checking it out.

xinaesthete commented 7 years ago

My pleasure.

edit: Redundantly explaining my possibly related bug in the project where we use this, then realised I already had above.

I still have a weird bug in the project where I use this library (which I haven't been able to reproduce elsewhere) where buttons and poses get confused somehow (so that you have to point with one controller and press a button with the other). I think we must be doing something 'interesting' with controllers in our code somewhere in that project, but it could still be upstream somewhere I suppose.

Anyway, from my testing I believe that this PR helps rather than hindering. I have noticed that while you are pressing with one controller, then the hover highlight from the other controller doesn't appear. I should check whether that's consistent with the old behaviour, it could be a new (albeit minor and hopefully easy to fix) bug.

Another edge-case thing I notice is that if you have one controller button holding on something like a slider, then press the button of the other controller on the same slider, the second controller will either override or do nothing depending on which was first... I quite like the overriding behaviour letting you do a sort of quick toggle between the two values actually, so if I were to try to fix it I'd probably make it do that regardless of the order, or even potentially have an option for either... but it really is edge case and not a priority.

xinaesthete commented 7 years ago

Hmmm. So I went back and reviewed the hover behaviour and it seems that what I described was also similar before. Worth noting I suppose, but far from a show-stopping bug.

xinaesthete commented 7 years ago

It would be good if you could review this when you get a chance @mflux. FWIW, as I thought the other bugs I mentioned were to do with some of how the logic for handling swapping out Vive controllers when they need charging in the project where we use this interacted with THREE.ViveController.

I believe the changes in this PR are sound.

mflux commented 7 years ago

I just checked it out, it looks great! Thank you for this fix. Feels really good to drag the gui around and still pull the controls.