Commit 3e6cb79
Refactor hand controls, oculus touch support (#2132)
* use Oculus Touch support in Chromium builds using vive-controls and tracked-controls
fixes to make Vive work as expected (including hand model rotation)
fix various verification issues (whitespace, quotes, eqeqeq)
first pass at hand controls refactor
refactor working with Touch
better explanatory comments; renamed modeled-controllers to auto-detect-controllers for clarity
FIXME: need models for Oculus Touch
fix lint issues that local git commit hook didn't flag
automated tests fail unless tracked-controls id default is 'OpenVR Gamepad' :-/
since each hand named differently, avoid enumeration
limit controller list rebuilds to roughly 1 second intervals
show that multiple specification works as well as auto-detection
allow multiple specification
- don't inject tracked-controls if controller not in getGamepads()
- don't attach listeners unless controller present
- poll for presence at roughly 1 second intervals if no gamepad connection events received
per discussion on #2132
remove auto-detect-controllers from core for now
(it can be used as external component)
per discussion on #2132
remove auto-detect-controllers from core for now
(it can be used as external component)
per discussion on #2132
tidy up and move enumerateGamepads into utils
per further discussion on #2132
change name of Touch thumbstick events and prepare for multiple-event button mappings
introduce namespaced vendor-specific events, and hand-specific mappings
(since button names differ between hands)
per discussion on #2132
use a common controlConfiguration object
change start/stopListening to add/removeEventListeners
per discussion on #2132 (review)
emit event others can listen for on tick
use controller list built by system tick rather than re-enumerating
instead of having another tick method, listen for system tick
distinguish between enumerateGamepads and enumerateControllers
- enumerateGamepads interrogates gamepad API
- enumerateControllers uses system tick-generated controller list
loosen throttle on tick since pose updates at that frequency
for consistency with vive-controls, default rotationOffset to 0;
where hand rotation is necessary, do it there (e.g. hand-controls)
make removeTrackedControlsTickListener accessible
ignore undefined button mapping
ignore undefined buttonMeshes
bind this pointer for gamepad event handlers
* updated to use models from @tbalouet
fix regression that broke rotationOffset
support surface button
* use new oculus touch compatible hand models; TODO: emit events for animations/poses
change processAnimation() to animate() and simplify flow,
and remove superfluous comment,
per discussion on #2132
system button never seen/sent; move menu button mapping
per discussion on #2132
change member idPrefix to const (and also model URLs)
per discussion on #2132
move model selection into addModel
per discussion on #2132
refactor to use utils function isControllerPresent
per discussion on #2132
emit hand events like original version did
original vive-specific events used gripclose/open, not gripup/down
remove tracked-controls dependency,
since that can apparently cause blank tracked-controls which won't work;
synthesize fake touch events for Oculus Touch trigger and grip,
since current browser builds appear to have them stuck touched;
make hand-controls process and use trigger and grip touches
refactor systems/tracked-controls so rebuildControllerList() is available outside tick;
explicitly rebuildControllerList if none in isControllerPresent() to avoid race
where gamepadconnected event triggers isControllerPresent() before tick rebuilds list
add support for Vive touchpad touchstart/end
remove enumerateControllers and change enumerateGamepads to getGamepadsByPrefix
per discussion on #2132
remove obsoleted lines
per discussion on #2132
use models from a-frame cdn
once aframevr/assets#4 is merged
remove obsoleted comment
various code cleanup as requested
per discussion on #2132
one more bit of cleanup
per discussion on #2132
another round of code cleanup
per discussion on #2132
accommodate renaming in aframevr/assets@66314f8
additional code cleanup
per discussion on #2132
clean up animation usage
remove oculus-touch namespace prefix from Oculus Touch-specific buttons/events
refactor into gestures with animation and legacy event mappings, and some cleanup
per discussion on #2132
for capacitive tracking, don't use menu button label, use B-or-Y,
since at some point we will hopefully get access to the true menu buttons
explicitly listen for A, B, X and Y touch events separately
(gesture handling still uses AorX and BorY internally)
remove A-or-X and B-or-Y event mapping
move persisting gesture and change detection into handleButton;
animateGesture and emitGestureEvents are now explicitly passed arguments
minor code cleanup
per discussion on #2132
one-liner cleanup
code cleanup as per discussion on #2132
code cleanup and fake touch simplification
whitespace cleanup
* disable unhooking on gamepad connected/disconnected events for now, as it is causing issues with Nightly
added comment on Nightly workaround1 parent ae69e1d commit 3e6cb79
File tree
17 files changed
+1039
-79
lines changed- docs/components
- examples/showcase/tracked-controls
- components
- src
- components
- systems
- utils
- tests/components
17 files changed
+1039
-79
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | | - | |
13 | | - | |
14 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
40 | 46 | | |
41 | 47 | | |
42 | 48 | | |
43 | | - | |
44 | | - | |
| 49 | + | |
| 50 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
0 commit comments