Interactor implementation used for touch bases interactions to interact with Interactable components with the mouse cursor in preview window of Lens Studio

There are no events for mouse hover in Lens Studio so this class uses some technics to achieve both hover and trigger events.

Hierarchy (view full)

Constructors

Properties

_dragProvider: DragProvider = ...
_drawDebug: boolean = false
_maxRaycastDistance: number = 500
_planecastDragProvider: DragProvider = ...
_previousStartPoint: vec3 = null
api: Record<string, any>
currentDragVector: vec3 = null

Returns the current vector associated to a dragging movement since the last frame, and null if not dragging

currentInteractable: Interactable = null

Returns the current targeted interactable or null.

currentTrigger: InteractorTriggerType = InteractorTriggerType.None

Returns the current trigger value

enabled: boolean = true

If disabled, the Component will stop enacting its behavior.

indirectDragThreshold: number = 3.0
indirectTargetingVolumeMultiplier: number = 1
inputType: InteractorInputType = InteractorInputType.None

Defines the interactor's input type. This can be used for prioritization or for discerning controller vs hands.

interactionManager: InteractionManager = ...
name: string
onCurrentInteractableChanged: PublicApi<Interactable> = ...

Called whenever the Interactor changes the target Interactable

previousDragVector: vec3 = null

Returns the nullable drag vector, computed in the previous frame

previousInteractable: Interactable = null

Returns the previous targeted interactable or null.

previousTrigger: InteractorTriggerType = InteractorTriggerType.None

Returns the previous trigger value

sceneObject: SceneObject

The scene object this component is on.

spherecastDistanceThresholds: number[] = ...
sphereCastEnabled: boolean = false
spherecastRadii: number[] = ...
transform: Transform
uniqueIdentifier: string
updatePriority: number

Accessors

  • get activeTargetingMode(): TargetingMode
  • Returns the targeting mode used to obtain the targeted interactable

    Returns TargetingMode

  • get deltaStartPosition(): vec3
  • Returns the delta start position from previous frame

    Returns vec3

  • get direction(): vec3
  • Returns the direction the interactor's ray is pointing toward.

    Returns vec3

  • get distanceToTarget(): number
  • Deprecated

    in favor of using targetHitInfo Returns the distance to the current target in cm

    Returns number

  • get dragProvider(): DragProvider
  • Returns DragProvider

  • set dragProvider(provider): void
  • Parameters

    Returns void

  • get dragType(): DragType
  • Used to define the type of drag vector that the interactor is invoking. By default, interactor drag vectors will be as SixDof drags.

    Returns DragType

  • get drawDebug(): boolean
  • Returns boolean

    if the Interactor is currently drawing a debug gizmo of collider/raycasts in the scene.

  • set drawDebug(debug): void
  • Set if the Interactor is should draw a debug gizmo of collider/raycasts in the scene.

    Parameters

    • debug: boolean

    Returns void

  • get endPoint(): vec3
  • Returns the point where the interactor's ray ends.

    Returns vec3

  • get interactionStrength(): number
  • Returns a normalized value from 0-1, where 0 is the lowest strength and 1 the highest. Returns null if the strength cannot be computed.

    Returns number

  • get maxRaycastDistance(): number
  • Returns the maximum raycast length for world targeting in cm

    Returns number

  • get orientation(): quat
  • Returns the orientation of the interactor

    Returns quat

  • get planecastDragVector(): vec3
  • Returns vec3

    the drag vector projected onto the plane defined by the current Interactable's forward and origin

  • get planecastPoint(): vec3
  • Returns vec3

  • get startPoint(): vec3
  • Returns the point where the interactor's ray starts.

    Returns vec3

  • get targetHitInfo(): InteractableHitInfo
  • Returns the InteractableHitInfo describing the intersection with the current target This includes information such as the intersection position/normal, the Interactable, the collider, etc

    Returns InteractableHitInfo

  • get targetHitPosition(): vec3
  • Deprecated

    in favor of using targetHitInfo Returns the point at which the interactor intersected the current target

    Returns vec3

Methods

  • Clears the current Interactable, used when an Interactable is deleted at runtime

    Returns void

  • Projects the direct collider's position onto the plane defined by the Interactable's forward vector / origin

    Parameters

    • interactable: Interactable

      the Interactable used to define the plane of intersection

    Returns vec3

    the direct collider's position projected onto the plane

  • Destroys the component.

    Returns void

  • Returns the name of this object's type.

    Returns string

  • Returns true if the interactor is active

    Returns boolean

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

    Parameters

    • type: string

    Returns boolean

  • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

    Parameters

    Returns boolean

  • Returns true if the interactor is actively targeting

    Returns boolean

  • Returns void

  • Calculates the intersection of the Interactor's indirect raycast and the plane defined by the Interactable's forward vector / origin

    Parameters

    • interactable: Interactable

      the Interactable used to define the plane of intersection

    Returns vec3

    the intersection point of the indirect raycast and plane

  • Removes a previously added SceneEvent from the ScriptComponent.

    Parameters

    Returns void

  • Disables or enables the input powering this interactor

    Parameters

    • enabled: boolean

      whether the input powering the interactor should be enabled

    Returns void

  • Updates the targeting and trigger state of the interactor

    Returns void