JSPM

aframe-raycaster-thresholds

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q37410F
  • License MIT

Enables configuration of the proximity thresholds for raycasting against lines and points.

Package Exports

  • aframe-raycaster-thresholds
  • aframe-raycaster-thresholds/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (aframe-raycaster-thresholds) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Overview

A component that enables configuration of the proximity thresholds for raycasting against lines and points.

This is useful because the default thresholds for raycasting against lines and points is 1m, which is far too large for many applications. See this A-Frame issue.

Schema

Property Description Default
line The accuracy threshold (in meters) to use when raycasting against lines 0.01
points The accuracy threshold (in meters) to use when raycasting against points 0.01

Installation

Via CDN

<script src="https://cdn.jsdelivr.net/npm/aframe-raycaster-thresholds@0.1.0/index.min.js"></script>

Or via npm

npm install aframe-raycaster-thresholds

Usage

To use thresholds of 1cm rather than 1m, just set on a Entity that uses raycasting, like this:

<a-entity cursor="rayOrigin:mouse" raycaster="objects:.raycastable" raycaster-thresholds>

Or to specify specific non-default thresholds (for example):

<a-entity cursor="rayOrigin:mouse" raycaster="objects:.raycastable"
          raycaster-thresholds="line: 0.02; points: 0.03">

Examples

raycaster-thresholds.html

Code

raycaster-thresholds