How super-hands works: Core vs Reaction Components
masterThe super-hands library uses a two-part architecture to enable natural interactions (gestures) in A-Frame:
Core Component (
super-hands): This component is placed on the user's input devices (tracked controllers, cursors, or raycasters). Its job is to gather raw input and collision data and interpret them into high-level gestures. It then communicates these gestures to targeted entities via custom events.Reaction Components: These are placed on the entities you want to interact with (e.g., a box or a sphere). They listen for the gesture events emitted by the Core component and execute the corresponding behavior (like moving, resizing, or changing color).
Supported Gestures:
- Hover: Holding a controller in an entity's collision space or pointing a cursor/laser at it.
- Grab: Pressing a button while hovering an entity.
- Stretch: Grabbing an entity with two hands and resizing it.
- Drag-drop: Activating one entity and gesturing to another to interact with it.
<!-- Core component on the controller -->
<a-entity super-hands hand-controls="hand: left"></a-entity>
<!-- Reaction component on the target object -->
<a-box grabbable hoverable></a-box>