GazePointer class

Gaze-based pointer for VR interaction (look to select). Fires a ray from the camera center forward direction.

Supports adaptive dwell timing (repeated selections of the same target become faster), a grace period that tolerates brief gaze slips, tactile haptic feedback on selection, and a richer reticle with progress feedback states.

Constructors

GazePointer({required CameraRig cameraRig, double dwellDuration = 2.0, double minDwellDuration = 0.6, double dwellAcceleration = 0.8, bool adaptiveDwell = true, double gazeGracePeriod = 0.15, bool enableHaptics = true, void onDwellSelect(String nodeId)?, void onTap(String nodeId)?, void onGazeEnter(String nodeId)?, void onGazeExit(String nodeId)?, void onDwellProgress(String nodeId, double progress)?})

Properties

adaptiveDwell bool
Whether repeated selections of the same target shrink the dwell time.
getter/setter pair
cameraRig CameraRig
final
dwellAcceleration double
Dwell acceleration factor applied each time the same target is dwell-selected consecutively (0.8 = 20% faster each time).
getter/setter pair
dwellDuration double
Duration in seconds to dwell-select a fresh target.
getter/setter pair
dwellProgress double
Current dwell progress (0 to 1).
getter/setter pair
effectiveDwellDuration double
The effective dwell duration currently in use (after adaptation).
no setter
enableHaptics bool
Whether to trigger subtle tactile haptic feedback on gaze enter and dwell selection.
getter/setter pair
gazeGracePeriod double
Grace period in seconds: if the gaze briefly leaves the target for less than this, the dwell timer is preserved instead of reset.
getter/setter pair
gazeTargetId String?
ID of the node currently being gazed at.
no setter
hashCode int
The hash code for this object.
no setterinherited
minDwellDuration double
Minimum dwell duration when adaptiveDwell accelerates repeated selections of the same target.
getter/setter pair
onDwellProgress ↔ void Function(String nodeId, double progress)?
Callback with dwell progress updates (nodeId, progress 0..1).
getter/setter pair
onDwellSelect ↔ void Function(String nodeId)?
Callback when a target is selected via dwell.
getter/setter pair
onGazeEnter ↔ void Function(String nodeId)?
Callback when gaze enters a target.
getter/setter pair
onGazeExit ↔ void Function(String nodeId)?
Callback when gaze exits a target.
getter/setter pair
onGazeSelect ↔ void Function(String nodeId)?
Alias for onDwellSelect.
getter/setter pair
onTap ↔ void Function(String nodeId)?
Callback when a target is tapped/clicked.
getter/setter pair
ray → Ray
The ray from camera center in forward direction.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
renderReticle(Canvas canvas, Size viewportSize) → void
Renders the reticle (crosshair) at screen center with dwell feedback: an accent progress ring, tick marks, and a selection flash.
resetAdaptation() → void
Resets adaptive dwell acceleration (e.g. when the scene changes).
toString() String
A string representation of this object.
inherited
triggerTap(RaycastHit? hit) → void
Manually trigger a tap/click event on the currently gazed target.
update(double dt, String? hitNodeId, {bool dwellEnabled = true}) → void
Call each frame with the currently gazed node ID (or null).

Operators

operator ==(Object other) bool
The equality operator.
inherited