Skip to content

Cursor ​

The pointer used to interact with GUI elements. Four designs are available, and it supports gaze (fuse) interaction for mobile and headset use.

a-sxr-cursor Component ​

Properties ​

PropertyDescriptionDefault Value
colorCursor initial color#F1F5F9
hover-colorCursor hover color#0EA5E9
active-colorCursor selection/active color#2563EB
distancedistance of the pointer from the camera-1
designchoose a design: 'dot', 'ring', 'cross' or 'reticle''dot'

The a-sxr-cursor primitive includes a pre-scoped raycaster by default (objects: [sxr-interactable], interval: 100), so cursor raycasts only test interactive widgets instead of the whole scene. Override it with a raycaster="..." attribute if you need different targets.

html
		<!-- Camera + cursor. -->
		<a-entity id="cameraRig" position="0 1.6 0">
			<a-camera look-controls wasd-controls position="0 0 0">
				<a-sxr-cursor id="cursor"
						  fuse="true" fuse-timeout="2000"
						  color="#ECEFF1"
						  hover-color="#CFD8DC"
						  active-color="#607D8B"
						  design="ring" > <!-- dot, ring, reticle, cross  -->
				</a-sxr-cursor> <!-- /cursor -->
			</a-camera> <!-- /camera -->
		</a-entity>

Designs ​

designAppearanceTypical use
dotSmall filled dotDesktop mouse-like pointer
ringHollow ringGaze and general use
crossCrosshairPrecision pointing
reticleReticle with armsVR-style targeting

Gaze (fuse) ​

Set fuse="true" to activate by dwelling on a widget. fuse-timeout controls the dwell duration in milliseconds; the cursor renders a progress ring while dwell is in progress.

html
<a-sxr-cursor fuse="true" fuse-timeout="1500" design="ring"></a-sxr-cursor>

Raycaster override ​

The default raycaster is already scoped to interactive widgets. Override it when you need different targets:

html
		<!-- Camera + cursor. -->
		<a-entity id="cameraRig" position="0 1.6 0">
			<a-camera look-controls wasd-controls position="0 0 0">
				<a-sxr-cursor id="cursor"
						  raycaster="objects: [sxr-interactable]"
						  fuse="false"
				>
				</a-sxr-cursor> <!-- /cursor -->
			</a-camera> <!-- /camera -->
		</a-entity>

Distance ​

distance positions the pointer relative to the camera. The default of -1 lets the cursor sit at the ray intersection; set a positive value to pin it at a fixed distance in front of the camera.