Preparing search index...

    Class InteractionComponent

    Enables invoking touch interactions with a BaseMeshVisual rendered to specific Camera.

    Sometimes touch events within lens may collide with Snapchat touch events. To avoid this use Touch Blocking.

    Lens Scripting Version 141

    // Pass in a MeshVisual
    // @input Component.BaseMeshVisual myMeshVisual

    // Get a reference to the InteractionComponent
    var interactionComponent = script.sceneObject.getComponent("Component.InteractionComponent");

    // Sets the MeshVisual to handle touches
    interactionComponent.addMeshVisual(script.myMeshVisual);

    // Allow certain touch types to be passed to Snapchat
    interactionComponent.addTouchBlockingException("TouchTypeDoubleTap");
    //@input Component.InteractionComponent interactionComponent

    // Subscribe to the onTap event
    var onTapEvent = script.interactionComponent.onTap.add(function(tapEventArgs){
    print("onTap!");
    });

    // Unsubscribe from the onTap event
    script.interactionComponent.onTap.remove(onTapEvent);

    Hierarchy (View Summary)

    Index

    Properties

    enabled: boolean

    If disabled, the Component will stop enacting its behavior.

    true
    
    isBeingDestroyed: boolean

    Returns true if this Component is currently being destroyed. Becomes true as soon as destruction begins via Component#destroy or destruction of its owning SceneObject, before any OnDestroyEvent callbacks fire.

    Lens Scripting Version 364

    if (!script.isBeingDestroyed) {
    // Component is still fully alive
    }
    isEnabledInHierarchy: boolean

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

    isFilteredByDepth: boolean

    When enabled, interaction events will be invoked only on the"closest" object, where order is defined by distance from camera and camera render order.

    Lens Scripting Version 195

    true
    
    isFocused: boolean

    Returns whether the user is currently gazing at the object on wearable devices, and when the user is touching on mobile devices.

    Lens Scripting Version 148

    isSelected: boolean

    Returns whether the user is currently selecting and gazing at an object on wearable devices, or touching it on mobile devices.

    Lens Scripting Version 148

    onDoubleTap: event1<DoubleTapEventArgs, void>

    Triggered when the user double taps on the screen.

    Lens Scripting Version 193

    onFocusEnd: event1<FocusEndEventArgs, void>

    On mobile devices, this is triggered when the user releases their touch. On wearable devices, this is triggered when the user looks away from the current object.

    Lens Scripting Version 148

    onFocusStart: event1<FocusStartEventArgs, void>

    On mobile devices, this is triggered when the user starts touching. On wearable devices, this is triggered when the user gazes on the current object.

    Lens Scripting Version 148

    onHover: event1<HoverEventArgs, void>

    Gets called when hover events are passed to the lens.

    Lens Scripting Version 324

    onHoverEnd: event1<HoverEndEventArgs, void>

    Gets called when hover events are finished.

    Lens Scripting Version 324

    onHoverStart: event1<HoverStartEventArgs, void>

    Gets called when hover event is initially triggered.

    Lens Scripting Version 324

    onLongPressEnd: event1<LongPressEndEventArgs, void>

    Triggered when the user ends a tap and hold.

    Lens Scripting Version 327

    onLongPressStart: event1<LongPressStartEventArgs, void>

    Triggered when the user begins to tap and hold.

    Lens Scripting Version 327

    onPanEnd: event1<PanEndEventArgs, void>

    Triggered when the pan ends.

    Lens Scripting Version 327

    onPanMove: event1<PanMoveEventArgs, void>

    Triggered when the user is panning.

    Lens Scripting Version 327

    onPanStart: event1<PanStartEventArgs, void>

    Triggered when the user starts to pan across the screen.

    Lens Scripting Version 327

    onPinchEnd: event1<PinchEndEventArgs, void>

    Triggered when the user ends the pinch.

    Lens Scripting Version 327

    onPinchMove: event1<PinchMoveEventArgs, void>

    Triggered when the user is pinching the screen.

    Lens Scripting Version 327

    onPinchStart: event1<PinchStartEventArgs, void>

    Triggered when the user pinches the screen.

    Lens Scripting Version 327

    onScroll: event1<ScrollEventArgs, void>

    Gets called when user scrolls on screen.

    Lens Scripting Version 141

    onScrollEnd: event1<ScrollEndEventArgs, void>

    Gets called when scroll ends.

    Lens Scripting Version 141

    onScrollStart: event1<ScrollStartEventArgs, void>

    Gets called when scroll begins.

    Lens Scripting Version 141

    onSelectEnd: event1<SelectEndEventArgs, void>

    On mobile devices, this is triggered when the user releases their touch. On wearable devices, this is triggered when the user stops touching the current object.

    Lens Scripting Version 148

    onSelectStart: event1<SelectStartEventArgs, void>

    On mobile devices, this is triggered when the user starts touching the current object. On wearable devices, this is triggered when the user touches the touchpad while focusing on an object.

    Lens Scripting Version 148

    onTap: event1<TapEventArgs, void>

    Triggered when the user taps on the screen.

    Lens Scripting Version 148

    onTouchEnd: event1<TouchEndEventArgs, void>

    Triggered when a touch event ends.

    Lens Scripting Version 148

    onTouchMove: event1<TouchMoveEventArgs, void>

    Triggered when a touch position on the screen is moved.

    Lens Scripting Version 148

    onTouchStart: event1<TouchStartEventArgs, void>

    Triggered when a touch event starts--either on the screen or on a touchpad. On wearables with touchpad, the coordinate returned are based on the touchpad and not the screen.

    Lens Scripting Version 148

    onTriggerPrimary: event1<TriggerPrimaryEventArgs, void>

    Gets called when the user triggers the primary input on their device. For example touch on touch screens.

    Lens Scripting Version 148

    sceneObject: SceneObject

    The SceneObject this component is on.

    uniqueIdentifier: string

    Lens Scripting Version 176

    Methods

    • Adds a MeshVisual as a target for interaction detection.

      Parameters

      Returns void

      Lens Scripting Version 141

    • Adds a touch type that this component will ignore.

      Parameters

      • exception: string

      Returns void

      Lens Scripting Version 141

    • Destroys the component.

      Returns void

    • Returns the minimum bounding box size used for detecting touches. Value range is from [0-1], relative to screen width.

      Returns number

      Lens Scripting Version 141

    • Returns the name of this object's type.

      Returns string

    • 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

    • Removes a MeshVisual as a target for interaction detection.

      Parameters

      Returns void

      Lens Scripting Version 141

    • Sets the camera that will be used for interaction detection.

      Parameters

      Returns void

      Lens Scripting Version 141

    • Sets the minimum bounding box size used for detecting touches. Value range is from [0-1], relative to screen width.

      Parameters

      • value: number

      Returns void

      Lens Scripting Version 141