Skip to main content

Class: Reticle

Defined in: src/ui/core/Reticle.ts:11

A 3D visual marker used to indicate a user's aim or interaction point in an XR scene. It orients itself to surfaces it intersects with and provides visual feedback for states like "pressed".

Extends

Constructors

Constructor

new Reticle(rotationSmoothing, offset, size, depthTest): Reticle

Defined in: src/ui/core/Reticle.ts:52

Creates an instance of Reticle.

Parameters

rotationSmoothing

number = 0.8

A factor between 0.0 (no smoothing) and 1.0 (no movement) to smoothly animate orientation changes.

offset

number = 0.001

A small z-axis offset to prevent z-fighting.

size

number = 0.019

The radius of the reticle's circle geometry.

depthTest

boolean = false

Determines if the reticle should be occluded by other objects. Defaults to false to ensure it is always visible.

Returns

Reticle

Overrides

THREE.Mesh<THREE.BufferGeometry, THREE.ShaderMaterial>.constructor

Properties

direction

direction: Vector3

Defined in: src/ui/core/Reticle.ts:20

The world-space direction vector of the ray that hit the target.


ignoreReticleRaycast

ignoreReticleRaycast: boolean = true

Defined in: src/ui/core/Reticle.ts:17

Prevents the reticle itself from being a target for raycasting.


intersection?

optional intersection: Intersection<Object3D<Object3DEventMap>>

Defined in: src/ui/core/Reticle.ts:32

The most recent intersection data that positioned this reticle.


name

name: string = 'Reticle'

Defined in: src/ui/core/Reticle.ts:14

Text description of the PanelMesh

Overrides

THREE.Mesh.name


offset

offset: number

Defined in: src/ui/core/Reticle.ts:29

The z-offset to prevent visual artifacts (z-fighting).


renderOrder

renderOrder: number = 1000

Defined in: src/ui/core/Reticle.ts:23

Ensures the reticle is drawn on top of other transparent objects.

Overrides

THREE.Mesh.renderOrder


rotationSmoothing

rotationSmoothing: number

Defined in: src/ui/core/Reticle.ts:26

The smoothing factor for rotational slerp interpolation.


targetObject?

optional targetObject: Object3D<Object3DEventMap>

Defined in: src/ui/core/Reticle.ts:35

Object on which the reticle is hovering.

Methods

getColor()

getColor(): Color

Defined in: src/ui/core/Reticle.ts:119

Gets the current color of the reticle.

Returns

Color

The current color from the shader uniform.


raycast()

raycast(): void

Defined in: src/ui/core/Reticle.ts:147

Overrides the default raycast method to make the reticle ignored by raycasters.

Returns

void

Overrides

THREE.Mesh.raycast


setColor()

setColor(color): void

Defined in: src/ui/core/Reticle.ts:111

Sets the color of the reticle via its shader uniform.

Parameters

color

The color to apply.

string | number | Color

Returns

void


setPoseFromIntersection()

setPoseFromIntersection(intersection): void

Defined in: src/ui/core/Reticle.ts:93

Updates the reticle's complete pose (position and rotation) from a raycaster intersection object.

Parameters

intersection

Intersection

The intersection data from a raycast.

Returns

void


setPressed()

setPressed(pressed): void

Defined in: src/ui/core/Reticle.ts:128

Sets the visual state of the reticle to "pressed" or "unpressed". This provides visual feedback to the user during interaction.

Parameters

pressed

boolean

True to show the pressed state, false otherwise.

Returns

void


setPressedAmount()

setPressedAmount(pressedAmount): void

Defined in: src/ui/core/Reticle.ts:138

Sets the pressed state as a continuous value for smooth animations.

Parameters

pressedAmount

number

A value from 0.0 (unpressed) to 1.0 (fully pressed).

Returns

void


setRotationFromNormalVector()

setRotationFromNormalVector(normal): void

Defined in: src/ui/core/Reticle.ts:75

Orients the reticle to be flush with a surface, based on the surface normal. It smoothly interpolates the rotation for a polished visual effect.

Parameters

normal

Vector3

The world-space normal of the surface.

Returns

void