0.1.0 • Published 1 year ago

aframe-raycaster-thresholds v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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

PropertyDescriptionDefault
lineThe accuracy threshold (in meters) to use when raycasting against lines0.01
pointsThe accuracy threshold (in meters) to use when raycasting against points0.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