aframe-vive-cursor-component
This is an A-Frame component for adding a cursor to an HTC Vive controller.
API
Property | Description | Default Value |
---|---|---|
color | Laser color | 0x0000ff |
radius | Laser radius (top and bottom) | 0.001 |
objects | Query selector to pick which objects to test for intersection. If not specified, all entities will be tested. | "" |
Usage
Simply attach the component to an entity alongside the vive-controls component.
As it is based on A-Frame's built-in cursor, many of the events and states are shared.
Note that "mouseup" and "mousedown" have been mapped to the trigger. In other words, pulling the trigger is the same as clicking.
Notes
To avoid intersecting with the laser, the raycaster's "near" property is set to 0.03. As a result, you may see odd results when the top of the controller is held extremely close to the entity you wish to intersect.
This component was built for the Vive controller model. If you are using the hand model or a different model entirely, you may need to modify the raycaster and position of the laser.
Browser
Install and use by directly including the browser files:
My A-Frame Scene
npm
Install via npm:
npm install aframe-vive-cursor-component
Then register and use.
;;