ScenePointer class Picking and input
A programmatic pointer into a scene: a crosshair, a gamepad-driven cursor, a VR laser, or the built-in pointer behind automatic widget input.
The caller decides where the ray comes from (pointAt from a screen position, or pointAlong for an arbitrary ray); the pointer owns everything downstream: the raycast, widget-surface UV mapping, event forwarding, capture, and hover state. Several pointers coexist, each with independent capture and hover.
Filtering has two distinct axes:
- layerMask / where / maxDistance control what the ray HITS (the occlusion set). Defaults hit everything raycastable, so blocking is physically correct out of the box; a wall in front of a panel stops the pointer.
- interactionMask controls which widget surfaces this pointer may DRIVE. Events forward only when the nearest hit's node carries a WidgetComponent and intersects this mask.
While pressed, the interaction is captured: moves and the release route to the pressed surface even when the ray slides off it (other geometry is ignored until release), the standard pointer-capture semantics that keep drags alive at surface edges.
Hover (hit, hoveredWidget, hoverChanged) is query state for the caller (crosshair highlights, cursor feedback); it is not forwarded into the widgets (widget-level hover needs MouseTracker integration, a planned follow-up).
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hit → SceneRaycastHit?
-
The latest raycast hit (from the occlusion set), or null when the ray
misses everything in range.
no setter
- hoverChanged → ChangeNotifier
-
Notifies when hoveredWidget changes.
final
- hoveredWidget → WidgetComponent?
-
The widget component the pointer is over (nearest hit, interaction
mask passed), or null. While pressed this stays the captured surface.
no setter
- interactionMask ↔ int
-
Which widget surfaces this pointer may drive (against Node.layers).
getter/setter pair
- isPressed → bool
-
Whether a press is in progress.
no setter
- layerMask ↔ int
-
The occlusion set: layers the ray tests (against Node.layers).
getter/setter pair
- maxDistance ↔ double
-
The pointer's reach, world units.
getter/setter pair
- pointerId → int
-
This pointer's id within each widget surface's forwarding state;
distinct per ScenePointer so concurrent pointers never share
capture.
final
- pressTravel → double
-
UV-space distance traveled between the last press and now (or the
release), for click-versus-drag discrimination.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scene → Scene
-
The scene this pointer casts into.
final
- where ↔ bool Function(Node node)?
-
Optional occlusion predicate (exclude the player model, etc.).
getter/setter pair
Methods
-
cancel(
) → void - Cancels the current press without completing it.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pointAlong(
Ray ray) → void -
Points along
ray(world space; direction need not be normalized). -
pointAt(
Offset screenPosition, {required Camera camera, required Size viewSize}) → void -
Points along the ray leaving
camerathroughscreenPositioninside a view ofviewSizelogical pixels. -
press(
) → void - Presses at the current pointer location. Forwards a pointer-down when the pointer is over a widget surface; otherwise the press is blocked (it landed on world geometry or empty space).
-
release(
) → void - Releases the current press at the pointer's location.
-
scroll(
Offset scrollDelta) → void -
Scrolls at the pointer's location by
scrollDeltalogical pixels, driving scrollables in the hovered widget surface. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited