Ray casting · XR interaction

Also known as: laser pointer interaction

On this page 7

Ray casting is an XR interaction technique in which the system projects a virtual ray from a tracked hand, controller or head into the scene and treats the first object the ray intersects as the current target. In extended reality, it is the most common way to select and manipulate objects beyond arm’s reach, and it belongs to the Tracking & interaction toolkit alongside direct touch interaction, gaze and pinch and gesture recognition.

Users often know the technique as laser pointer interaction, because most interfaces draw the ray as a visible beam ending in a cursor dot. The idea is simple, but a usable implementation depends on stable pose data, careful filtering, clear feedback and a reliable confirmation gesture.

How ray casting selects a target

Ray casting works by turning a tracked pose into a mathematical ray with an origin and a direction and testing it against scene geometry every frame. The origin is usually the controller tip, the wrist or a point near the shoulder, while the direction comes from the orientation reported by 6DoF tracking.

The engine runs an intersection test against colliders, which are simplified shapes such as boxes, spheres or meshes attached to interactive objects. The nearest hit along the ray becomes the hover target, and the system then waits for a separate commit action, such as a trigger pull or a pinch, to confirm selection. Separating pointing from confirming is essential, because aiming and committing are different motor tasks.

The following table lists the components that a complete ray interaction pipeline contains.

ComponentRoleTypical implementation
Ray originAnchors the start of the rayController tip, wrist or shoulder-wrist line
Ray directionDefines where the user pointsController forward vector or hand-derived axis
Hit testFinds the first intersected objectPhysics raycast against colliders or UI planes
FilterSuppresses hand tremor and tracking jitterOne Euro filter or exponential smoothing
Commit inputConfirms the selectionTrigger, pinch, button or dwell timer
FeedbackShows target and stateBeam, cursor dot, highlight, haptic pulse
Components of a ray casting pipeline

Ray origins for controllers, hands and head

The choice of ray origin determines precision, comfort and robustness, and each input modality needs its own approach. With a motion controller, the ray follows the controller body closely, because the device has accurate optical or inertial tracking and a physical trigger for confirmation.

With hand tracking, the raw finger joints are too noisy to aim from directly. Many platforms therefore cast the ray along a line from an estimated shoulder point through the hand, which keeps the beam steady while the fingers move to pinch. Head-based rays, common on 3DoF devices and in accessibility modes, aim with the center of the field of view and usually confirm with a dwell timer or a single button.

The table compares the main ray sources used in current headsets.

Ray sourceStrengthMain weakness
Motion controllerHigh stability and tactile triggerRequires holding hardware
Hand trackingController-free and naturalJitter and pinch-induced aim shift
Head gazeWorks on simple headsetsSlow and tiring for long sessions
Eye gazeVery fast target acquisitionInaccurate for small targets and prone to accidental selection
Ray sources and their trade-offs

Ray casting compared with other XR selection methods

Ray casting is the default technique for distant targets, while other methods suit near-field or hands-busy work. Direct touch interaction lets users press virtual buttons with a fingertip, which is intuitive but limited to objects within roughly 0.6-0.8 m. Gaze and pinch uses eye tracking for aim and a hand pinch for commit, which reduces arm movement but depends on accurate eye calibration.

The table summarizes where each method fits best.

MethodBest distanceTypical use
Ray castingFrom about 1 m to the far sceneMenus, distant objects, panel interfaces
Direct touchWithin arm’s reachButtons, sliders, tactile manipulation
Gaze and pinchAny distance with large targetsFast browsing and system interfaces
Gesture recognitionIndependent of distanceShortcuts and mode switches
Selection methods in XR interaction

Well-designed applications combine near and far modes, switching automatically from a ray to direct touch when the hand approaches a panel. This hybrid model avoids the awkwardness of pointing at an object that the hand could simply grab.

Variants that improve precision

Plain ray casting struggles with small, distant or overlapping targets, because a small angular error at the hand becomes a large positional error far away. An error of only 1 degree shifts the hit point by about 17 cm at a distance of 10 m, which is enough to miss a menu item entirely.

Research and practice have produced several variants that address this problem.

  • Cone casting tests a narrow cone instead of a line and picks the best candidate inside it, which helps with small targets.
  • Bent or curved rays snap toward the most likely target, making selection feel forgiving without hiding the actual aim.
  • Depth ray techniques let the user slide a cursor along the ray to choose among objects that overlap in depth.
  • Target snapping and sticky cursors keep the ray attached to a target for a short time, which compensates for tremor during the commit action.
  • Parabolic rays follow an arc rather than a straight line and are standard for teleport locomotion over floors.

Each variant trades directness for assistance, so designers should make any snapping visible to avoid confusing the user about what is actually selected.

Design guidelines and common mistakes

Most ray casting problems come from missing feedback, unfiltered input or poorly sized targets, rather than from the technique itself. Interactive elements for ray input generally need an angular size of at least about 1-2 degrees, and hover states should appear immediately so users know what the ray touches before they commit.

The table connects frequent symptoms to their causes and fixes.

SymptomLikely causeRecommended fix
Cursor jitterUnfiltered tracking noiseApply adaptive smoothing such as a One Euro filter
Selection misses on pinchHand moves during the commit gestureFreeze or stabilize the ray during pinch
Wrong object selectedOverlapping collidersUse depth ray or priority rules
Arm fatigueInterface placed too highPlace panels below eye level and near the body
User loses the rayBeam hidden or too faintShow a clear cursor dot and contrasting beam
Ray casting symptoms and remedies

A frequent mistake is holding the arm extended for long periods, which produces the fatigue known as gorilla arm. Layouts that let users point from a relaxed elbow position, combined with haptic pulses on hover and select, make long sessions far more comfortable.

Explained without jargon

Ray casting works like a laser pointer in a virtual room. You aim your hand or controller at something far away, a beam shows where you are pointing, and a small dot marks the exact spot.

When the dot sits on the button or object you want, you pull a trigger or pinch your fingers to choose it. Aiming and clicking are two separate steps, which keeps you from selecting things by accident. The key idea is simple: you can use objects across the room without walking over to them.

A typical use case

An engineering team reviews a full-scale virtual model of a factory production line in a shared mixed reality session. The model fills a large hall, and the components under discussion sit 5 to 15 m away from the participants.

Each reviewer uses hand tracking with a shoulder-to-hand ray. Aiming at a conveyor motor highlights it with an outline, and a pinch opens its specification panel. Because the motors are small at that distance, the application uses cone casting with a visible snapping cursor, and it freezes the ray for a fraction of a second during each pinch.

After introducing these changes, the team reported that selection errors dropped noticeably and that reviewers no longer walked across the room to inspect parts. The session stayed comfortable because all menus appeared below eye level within easy pointing range.