UNPKG

super-hands

Version:

All-in-one natural hand controller interaction component for A-Frame.

36 lines (34 loc) 2.08 kB
<html> <head> <script src="build.js"></script> </head> <body> <a-scene avatar-recorder="spectatorPlay: true; spectatorPosition: 0 1.6 2" physics="driver: worker; gravity: 0"> <a-assets> <!-- <img id="grid" src="grid.png"/> --> <a-mixin id="controller" super-hands static-body="shape: sphere; sphereRadius: 0.02;" sphere-collider="objects: .cube"></a-mixin> <a-mixin id="cube" geometry="primitive: box; width: 0.5; height: 0.5; depth: 0.5" hoverable grabbable="usePhysics: only" stretchable draggable droppable dynamic-body event-set="_event: drag-drop; geometry.primitive: sphere; geometry.radius: 0.25" event-set__hoveron="_event: hover-start; material.opacity: 0.7; transparent: true" event-set__hoveroff="_event: hover-end; material.opacity: 1; transparent: false" event-set__dragon="_event: dragover-start; wireframe: true" event-set__dragoff="_event: dragover-end; wireframe: false"></a-mixin> </a-assets> <a-entity id="lhand" hand-controls="left" mixin="controller"></a-entity> <a-entity id="rhand" hand-controls="right" mixin="controller"></a-entity> <a-entity id="redLow" class="cube" mixin="cube" position="0 1 -1" material="color: red"></a-entity> <a-entity id="redHigh" class="cube" mixin="cube" position="0 1.6 -1" material="color: red"></a-entity> <a-entity id="blueLow" class="cube" mixin="cube" position="-1 1 -1" material="color: blue"></a-entity> <a-entity id="blueHigh" class="cube" mixin="cube" position="-1 1.6 -1" material="color: blue"></a-entity> <a-entity id="greenLow" class="cube" mixin="cube" position="1 1 -1" material="color: green"></a-entity> <a-entity id="greenHigh" class="cube" mixin="cube" position="1 1.6 -1" material="color: green"></a-entity> <a-plane rotation="-90 0 0" color="#888" width="50" height="50"></a-plane> </a-scene> </body> </html>