Lens Scripting API

    This class represents an interactable object that can respond to various interaction events such as hover, trigger, and drag. It provides event handlers for these interactions and uses the InteractionConfigurationProvider for configuration.

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    acceptableSyncInteractionTypes: number = 7

    Relevant only to lenses that use SpectaclesSyncKit when it has SyncInteractionManager in its prefab. If set to SyncInteractionType.All, any user connected to the session can interact with this Interactable. If set to SyncInteraction.Host, only the session host can interact with this Interactable. If set to SyncInteraction.Local, only the local user can interact with this Interactable. Make sure to programmatically define the local user by setting interactable.localConnectionId to the user's connection ID. If set to SyncInteraction.HostAndLocal, both the host and local user can interact with this Interactable.

    acceptableXDirections: number = 0

    Controls from which directions a poke interaction can trigger this Interactable along the X-axis:

    • Left: Finger must approach from -X direction.
    • Right: Finger must approach from +X direction.
    • All: Accepts both directions.
    • None: Disables X-axis poke detection.
    acceptableYDirections: number = 0

    Controls from which directions a poke interaction can trigger this Interactable along the Y-axis:

    • Top: Finger must approach from +Y direction
    • Bottom: Finger must approach from -Y direction
    • All: Accepts both directions
    • None: Disables Y-axis poke detection
    acceptableZDirections: number = 1

    Controls from which directions a poke interaction can trigger this Interactable along the Z-axis:

    • Front: Finger must approach from +Z direction.
    • Back: Finger must approach from -Z direction.
    • All: Accepts both directions.
    • None: Disables Z-axis poke detection.
    allowMultipleInteractors: boolean = true

    Determines whether this Interactable can be simultaneously controlled by multiple Interactors. When false, only one Interactor type (e.g., left hand or right hand) can interact with this Interactable at a time, and subsequent interaction attempts from different Interactors will be blocked. Set to true to enable interactions from multiple sources simultaneously, such as allowing both hands to manipulate the Interactable at once.

    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.

    colliders: ColliderComponent[] = []

    Provides all colliders associated with this Interactable.

    enabled: boolean

    If disabled, the Component will stop enacting its behavior.

    enableInstantDrag: boolean = false

    Enable this to allow the Interactable to instantly be dragged on trigger rather than obeying the Interactor's drag threshold.

    enablePokeDirectionality: boolean = false

    Enable Poke Directionality to help prevent accidental interactions when users approach from unwanted angles.

    isScrollable: boolean = false

    A flag that enables scroll interactions when this element is interacted with. When true, interactions with this element can scroll a parent ScrollView that has content extending beyond its visible bounds.

    isSynced: boolean = true

    Relevant only to lenses that use SpectaclesSyncKit when it has SyncInteractionManager in its prefab. If set to true on the same frame as creating the Interactable component, events targeting this Interactable will be propagated to other connections in the same lens.

    localConnectionId: string = null
    name: string
    onDragEnd: PublicApi<DragInteractorEvent> = ...

    Called when an interactor was in a down event with this interactable and was dragging.

    onDragStart: PublicApi<DragInteractorEvent> = ...

    Called when an interactor is in a down event with this interactable and has moved a minimum drag distance.

    onDragUpdate: PublicApi<DragInteractorEvent> = ...

    Called when an interactor is in a down event with this interactable and is moving.

    onHoverEnter: PublicApi<InteractorEvent> = ...

    Called whenever the interactable enters the hovered state.

    onHoverExit: PublicApi<InteractorEvent> = ...

    Called whenever the interactable is no longer hovered.

    onHoverUpdate: PublicApi<InteractorEvent> = ...

    Called whenever an interactor remains hovering over this interactable.

    onInteractorHoverEnter: PublicApi<InteractorEvent> = ...

    Called whenever a new interactor hovers over this interactable.

    onInteractorHoverExit: PublicApi<InteractorEvent> = ...

    Called whenever an interactor exits hovering this interactable.

    onInteractorTriggerEnd: PublicApi<InteractorEvent> = ...

    Called whenever an interactor is no longer triggering the interactable.

    onInteractorTriggerStart: PublicApi<InteractorEvent> = ...

    Called whenever an interactor triggers an interactable.

    onTriggerCanceled: PublicApi<InteractorEvent> = ...

    Called whenever an interactor is lost and was in a down event with this interactable.

    onTriggerEnd: PublicApi<InteractorEvent> = ...

    Called whenever the interactable exits the triggered state.

    onTriggerStart: PublicApi<InteractorEvent> = ...

    Called whenever the interactable enters the triggered state.

    onTriggerUpdate: PublicApi<InteractorEvent> = ...

    Called whenever an interactor continues to trigger an interactable.

    sceneObject: SceneObject

    The scene object this component is on.

    targetingMode: number = 3

    Defines how an interactor can interact with this interactable. Values are: 1: Direct: Only allows close pinch interactions where a hand directly touches the Interactable. 2: Indirect: Allows interactions from a distance with raycasting. 3: Direct/Indirect: Supports both direct and indirect interaction methods. 4: Poke: Enables finger poking interactions. 7: All: Supports all targeting modes (Direct, Indirect, and Poke).

    uniqueIdentifier: string
    updatePriority: number

    Accessors

    Methods

    • Notifies the interactable that it is exiting a dragged state with the interactor

      Parameters

      Returns void

    • Notifies the interactable that it is in a dragged state with the interactor

      Parameters

      Returns void

    • Notifies the interactable that it is entering hover state

      Parameters

      Returns void

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

      Parameters

      • type: string

      Returns boolean

    • Returns void

    • Returns void

    • Notifies the interactable that it is a cancelled state with the interactor

      Parameters

      Returns void

    • Notifies the interactable that it is entering trigger state

      Parameters

      Returns void

    • Notifies the interactable that it is still in a triggering state

      Parameters

      Returns void

    MMNEPVFCICPMFPCPTTAAATR