Skip to content

Commit 1c6f210

Browse files
committed
assign handedness to controller components, set raycaster objects to prevent rays from two controllers from intersecting each other
1 parent 8bc4730 commit 1c6f210

File tree

6 files changed

+44
-24
lines changed

6 files changed

+44
-24
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ v3.0.0
148148

149149
* Two-handed physics grabs don't feel great
150150
* Help wanted with configuring ideal constraints for this situation
151+
* `too much recursion` errors when using two raycasting controllers:
152+
When using raycasters,
153+
always set their `objects` property to prevent the raycasters from colliding
154+
with each other's lines.
151155

152156
## Compatibility
153157

examples/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ <h1>A-Frame Super Hands Component</h1>
107107
<li>Entities change to spheres upon completing drag-drop interaction via the
108108
<code>event-set</code> component listening for the 'drag-drop' event</li>
109109
</ul></p>
110-
<p><code>super-hands</code> can also be use with other types of input,
110+
<p><code>super-hands</code> can also be use with other types of input
111111
including 3DOF controllers, mouse, and touch. In these cases, a
112112
raycasting can be used intead of collision detection.
113113
The confugration below works with the A-Frame <code>raycaster</code>

examples/mouse/index-mouse.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</a-assets>
2828
<a-entity camera wasd-controls position="0 1 1"
2929
capture-mouse
30-
raycaster cursor="rayOrigin:mouse"
30+
raycaster="objects: .cube" cursor="rayOrigin:mouse"
3131
static-body="shape: sphere; sphereRadius: 0.001"
3232
super-hands="colliderEvent: raycaster-intersection;
3333
colliderEventProperty: els;

examples/mouse/index.html

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,20 @@
1818
touch-to-click-converter>
1919
<a-assets>
2020
<img id="portal-preview" src="../assets/physics.jpg"></img>
21-
<a-mixin id="controller"
22-
vive-controls oculus-touch-controls
23-
windows-motion-controls gearvr-controls daydream-controls
24-
oculus-go-controls
25-
raycaster="showLine: true"
26-
super-hands="colliderEvent: raycaster-intersection;
27-
colliderEventProperty: els;
28-
colliderEndEvent:raycaster-intersection-cleared;
29-
colliderEndEventProperty: clearedEls;">
21+
<a-mixin id="pointer" raycaster="showLine: true; objects: .cube, a-link"
22+
super-hands="colliderEvent: raycaster-intersection;
23+
colliderEventProperty: els;
24+
colliderEndEvent:raycaster-intersection-cleared;
25+
colliderEndEventProperty: clearedEls;">
26+
</a-mixin>
27+
<a-mixin id="controller-right" mixin="pointer"
28+
vive-controls="hand: right" oculus-touch-controls="hand: right"
29+
windows-motion-controls="hand: right"
30+
gearvr-controls daydream-controls oculus-go-controls>
31+
</a-mixin>
32+
<a-mixin id="controller-left" mixin="pointer"
33+
vive-controls="hand: left" oculus-touch-controls="hand: left"
34+
windows-motion-controls="hand: left">
3035
</a-mixin>
3136
<a-mixin id="cube" geometry="primitive: box; width: 0.5; height: 0.5; depth: 0.5"
3237
hoverable grabbable stretchable draggable droppable
@@ -39,8 +44,8 @@
3944
</a-mixin>
4045
</a-assets>
4146
<a-entity>
42-
<a-entity id="rhand" mixin="controller"></a-entity>
43-
<a-entity id="lhand" mixin="controller"></a-entity>
47+
<a-entity id="rhand" mixin="controller-right"></a-entity>
48+
<a-entity id="lhand" mixin="controller-left"></a-entity>
4449
</a-entity>
4550
<a-entity class="cube" mixin="cube" position="0 1 -1.25" material="color: red"></a-entity>
4651
<a-entity class="cube" mixin="cube" position="0 1.6 -1.5" material="color: red"></a-entity>

examples/physics/index-laser.html

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,17 @@
3838
event-set__dragoff="_event: dragover-end; material.wireframe: false"
3939
collision-filter="collisionForces: false"
4040
geometry="primitive: box; width: 0.5; height: 0.5; depth: 0.5"></a-mixin>
41-
<a-mixin id="controllers" vive-controls oculus-touch-controls
42-
windows-motion-controls gearvr-controls daydream-controls
41+
<a-mixin id="controllers-right" vive-controls="hand: right"
42+
oculus-touch-controls="hand: right"
43+
windows-motion-controls="hand: right"
44+
gearvr-controls daydream-controls
4345
oculus-go-controls>
4446
</a-mixin>
45-
<a-mixin id="point" mixin="controllers" raycaster="showLine: true"
47+
<a-mixin id="controllers-left" vive-controls="hand: left"
48+
oculus-touch-controls="hand: left"
49+
windows-motion-controls="hand: left">
50+
</a-mixin>
51+
<a-mixin id="point" raycaster="showLine: true; objects: .cube"
4652
collision-filter="collisionForces: false"
4753
static-body="shape: sphere; sphereRadius: 0.001"
4854
super-hands="colliderEvent: raycaster-intersection;
@@ -52,8 +58,8 @@
5258
</a-assets>
5359
<a-entity>
5460
<a-camera positon="0 1.6 0"></a-camera>
55-
<a-entity id="rhand" mixin="point"></a-entity>
56-
<a-entity id="lhand" mixin="point"></a-entity>
61+
<a-entity id="rhand" mixin="controllers-right point"></a-entity>
62+
<a-entity id="lhand" mixin="controllers-left point"></a-entity>
5763
</a-entity>
5864
<a-entity class="cube" mixin="cube" position="0 0.265 -1" material="color: red"></a-entity>
5965
<a-entity class="cube" mixin="cube" position="0 0.265 -0.5" material="color: red"></a-entity>

examples/physics/index.html

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@
5454
event-set__dragon="_event: dragover-start; material.wireframe: true"
5555
event-set__dragoff="_event: dragover-end; material.wireframe: false"
5656
geometry="primitive: box; width: 0.5; height: 0.5; depth: 0.5"></a-mixin>
57-
<a-mixin id="controllers" vive-controls oculus-touch-controls
58-
windows-motion-controls>
59-
</a-mixin>
60-
<a-mixin id="touch" mixin="controllers"
57+
<a-mixin id="touch"
6158
physics-collider phase-shift
6259
collision-filter="collisionForces: false"
6360
static-body="shape: sphere; sphereRadius: 0.02"
@@ -69,8 +66,16 @@
6966
</a-assets>
7067
<a-entity>
7168
<a-camera positon="0 1.6 0"></a-camera>
72-
<a-entity id="rhand" mixin="touch"></a-entity>
73-
<a-entity id="lhand" mixin="touch"></a-entity>
69+
<a-entity id="rhand" mixin="touch"
70+
vive-controls="hand: right"
71+
oculus-touch-controls="hand: right"
72+
windows-motion-controls="hand: right">
73+
</a-entity>
74+
<a-entity id="lhand" mixin="touch"
75+
vive-controls="hand: left"
76+
oculus-touch-controls="hand: left"
77+
windows-motion-controls="hand: left">
78+
</a-entity>
7479
</a-entity>
7580
<a-entity class="cube" mixin="cube" position="0 0.265 -1" material="color: red"></a-entity>
7681
<a-entity class="cube" mixin="cube" position="0 0.265 -0.5" material="color: red"></a-entity>

0 commit comments

Comments
 (0)