Lens Scripting API
    Preparing search index...

    This class represents a cursor for interactors, providing visual feedback for different interaction states. It manages the cursor's appearance, including its circle visual and manipulation line, and handles state changes and events.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _interactor?: BaseInteractor

    Reference to the component that this cursor will visualize. The cursor will update its position and appearance based on the interactor's state.

    api: Record<string, any>

    Generic object accessible by other instances of ScriptComponent. Use this object to store references to properties and methods that need to be accessible from other ScriptComponents.

    cursorAlpha: number = 0.0
    drawDebug: boolean = false

    Enable debug rendering for this cursor (propagated to the internal view model)

    enableCursorHolding: boolean = true

    Controls the "stickiness" of the cursor when hovering over interactable objects. When enabled, the cursor maintains its position on the target object, even when the hand moves slightly, making interaction with small targets easier. Only applies to hand-based interactions, not other input types like mouse. Disable for immediate 1:1 cursor movement that follows the hand position exactly.

    enabled: boolean

    If disabled, the Component will stop enacting its behavior.

    enableFilter: boolean = false

    Applies smoothing to cursor movement for hand-based interactions. When enabled, reduces jitter and makes cursor motion appear more stable, improving precision when interacting with small targets. Only applies to hand-based interactions.

    isEnabledInHierarchy: boolean

    Returns true if this Component, its SceneObject, and all of that SceneObjects parents are enabled.

    name: string
    onEnableChanged: PublicApi<boolean> = ...

    Called whenever the cursor changes enabled state (showing / hiding the cursor visual)

    onRayVisibilityChanged: PublicApi<boolean> = ...

    Called whenever the ray visibility changes (becomes visible or invisible based on rayAlpha threshold).

    sceneObject: SceneObject

    The SceneObject this component is on.

    uniqueIdentifier: string
    updatePriority: number
    visual: SceneObject

    Accessors

    • set cursorMode(mode: CursorMode): void

      Set the CursorMode of the cursor to change the visual To return the cursor to its default StateMachine logic, use CursorMode.Auto

      Parameters

      • mode: CursorMode

        The new mode of the cursor visual

      Returns void

    • get cursorParameters(): CursorParameters

      Returns CursorParameters

      the transform and material parameters of the cursor to allow other cursor implementations to re-use the same values.

    • get cursorPosition(): vec3

      Get the world position of this interactor's cursor visual

      Returns vec3

      vec3 of the worldPosition

    • set cursorPosition(position: vec3): void

      Set the world position of this interactor's cursor visual

      Parameters

      • position: vec3

        vec3 of the worldPosition, null to revert to default behavior to follow raycast

      Returns void

    • set customTexture(texture: Texture): void

      Set the Texture of the cursor when using the CursorMode.Custom mode Must explicitly set the CursorMode to CursorMode.Custom before the texture appears.

      Parameters

      • texture: Texture

        The custom texture (typically cached via requireAsset(.../assetName.png) as Texture) to use

      Returns void

    • get rayAlpha(): number

      Gets the current ray alpha value.

      Returns number

    • set rayAlpha(value: number): void

      Sets the ray alpha value and triggers visibility change events when crossing the threshold.

      Parameters

      • value: number

      Returns void

    • set renderOrder(renderOrder: number): void

      Set the render order of the cursor visual.

      Parameters

      • renderOrder: number

      Returns void

    • get useV2(): boolean

      Returns boolean

      Whether the cursor is using the V2 cursor implementation.

    Methods

    • Hides the cursor visual.

      Parameters

      • duration: number = 0.2

        The fade out duration.

      Returns void

    • Initializes the cursor with the useV2 setting from the CursorController.

      Parameters

      • _caller: CursorController

        The CursorController that initialized this cursor.

      • _useV2: boolean

        Whether to use the V2 cursor implementation.

      Returns void

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean

    • Returns void

    • Shows the cursor visual.

      Parameters

      • duration: number = 0.2

        The fade in duration.

      Returns void