Interaction
Touch, tap, gestures and manipulation, SPECS hand gestures (Gesture Module), keyboard and text input, controllers, and haptics.
Commonly used
TapEventThis event is triggered when the user taps on the screen.InteractionComponentEnables invoking touch interactions with a BaseMeshVisual rendered to specific Camera.GestureModuleAllows to detect hand gestures using machine learning algorithms.TouchEndEventTriggered when a touch event ends.TouchMoveEventTriggered when a touch position on the screen is moved.TouchStartEventTriggered when a touch event starts.
Guides
Gesture ModuleDetect pinch, palm tap, targeting, grab, and phone-in-hand gestures in a SPECS Lens with the Gesture Module APIs.KeyboardLet users type in a SPECS Lens: request the keyboard, read the text, and place your text field where the system suggests.Touch and InteractionsYou can add interactivity to the Lenses you create in Lens Studio by handling user touch input events.ArchitectureHow Interaction Kit for SPECS is structured: input data providers, interactors, Interactables, and the InteractionManager that processes their events each frame.Shadertoy to Lens StudioThis guide provides a reference for transcribing Shadertoy operations to Material Editor in Lens Studio.Animated ObjectThe Animated Object asset demonstrates a convenient way to add and interact with 3D models into the world.
All APIs in this topic
Add components to a scene object, reference assets and other modules with a script input, require modules with require('LensStudio:<name>'), and create events with script.createEvent('<name>').
Components, assets, and modules
| API | Description |
|---|---|
| GameControllerModule SPECS | Provides access to game controller input on Spectacles. |
| GestureModule SPECS | Allows to detect hand gestures using machine learning algorithms. |
| InteractionComponent | Enables invoking touch interactions with a BaseMeshVisual rendered to specific Camera. |
| ManipulateComponent | Handles input information from user touch input via the InteractionComponent to control the Scale, Rotation, and Translation of objects. |
| MotionControllerModule SPECS | |
| SpecsInteractionModule SPECS | Entry point for the SPECS Interaction System. |
| TextInputModule | Declares the Input Framework (Text) permission for your Lens project. |
Events
| API | Description |
|---|---|
| DoubleTapEvent | Triggered when a double tap event has occurred. |
| HoverEndEvent | Triggered when hovering state has ended on an InteractionComponent. |
| HoverEvent | Triggered when a mouse hover event occurs. |
| HoverStartEvent | Base class for all object-based Event types in Lens Studio (ManipulateStartEvent, TapEvent, etc.). |
| KeyPressEvent | This event is triggered when the user presses a key. |
| KeyReleaseEvent | This event is triggered when the user releases a key. |
| ManipulateEndEvent | This event is triggered when manipulation on the object ends. |
| ManipulateStartEvent | This event is triggered when manipulation on the object begins. |
| PanGestureEndEvent | Triggered when a pan gesture ends. |
| PanGestureMoveEvent | Triggered while the user is panning. |
| PanGestureStartEvent | Triggered when a pan gesture starts. |
| PinchGestureEndEvent | Triggered when a pinch gesture ends. |
| PinchGestureMoveEvent | Triggered while the user is pinching. |
| PinchGestureStartEvent | Triggered when a pinch gesture starts. |
| TapEvent | This event is triggered when the user taps on the screen. |
| TouchEndEvent | Triggered when a touch event ends. |
| TouchMoveEvent | Triggered when a touch position on the screen is moved. |
| TouchStartEvent | Triggered when a touch event starts. |
| TriggerPrimaryEvent | Gets called when the user triggers the primary input on their device. |
Event data
| API | Description |
|---|---|
| DoubleTapEventArgs | Base class for objects representing Script data. |
| FocusEndEventArgs | Arguments used with the InteractionComponent.onFocusEnd event. |
| FocusStartEventArgs | Arguments used with the InteractionComponent.onFocusStart event. |
| GesturesDataArgs SPECS | |
| GrabBeginArgs SPECS | The arguments of the GrabBegin event on GestureModule. |
| GrabEndArgs SPECS | The arguments of the GrabEnd event on GestureModule. |
| HoverEndEventArgs | The arguments passed in by HoverEndEvent. |
| HoverEventArgs | Base class for objects representing Script data. |
| HoverStartEventArgs | The arguments passed in by HoverStartEvent. |
| IsPhoneInHandBeginArgs SPECS | The arguments of getIsPhoneInHandBeginEvent on GestureModule. |
| IsPhoneInHandEndArgs SPECS | The arguments of getIsPhoneInHandEndEvent on GestureModule. |
| LongPressEndEventArgs | Arguments used with the InteractionComponent#onLongPressEnd event. |
| LongPressStartEventArgs | Arguments used with the InteractionComponent#onLonPressStart event. |
| ManipulateEndEventArgs | Arguments used with the ManipulateComponent.onManipulateEnd event. |
| ManipulateStartEventArgs | Arguments used with the ManipulateComponent.onManipulateStart event. |
| PalmTapDownArgs SPECS | The arguments of the PalmTapDown event on GestureModule |
| PalmTapUpArgs SPECS | The arguments of the PalmTapUp event on GestureModule |
| PanEndEventArgs | Arguments used with the InteractionComponent#onPanEnd event. |
| PanMoveEventArgs | Arguments used with the InteractionComponent#onPanMove event. |
| PanStartEventArgs | Arguments used with the InteractionComponent#onPanStart event. |
| PinchDownArgs SPECS | The arguments of the PinchDown event on GestureModule |
| PinchEndEventArgs | Arguments used with the InteractionComponent#onPinchEnd event. |
| PinchMoveEventArgs | Arguments used with the InteractionComponent#onPinchMove event. |
| PinchStartEventArgs | Arguments used with the InteractionComponent#onPinchStart event. |
| PinchStrengthArgs SPECS | The arguments of the PinchStrength event on GestureModule |
| PinchUpArgs SPECS | The arguments of the PinchUp event on GestureModule |
| ScrollEndEventArgs | Arguments used with the InteractionComponent#onScrollEnd event. |
| ScrollEventArgs | Arguments used with the InteractionComponent#onScroll event. |
| ScrollStartEventArgs | Arguments used with the InteractionComponent#onScrollStart event. |
| SelectEndEventArgs | Arguments used with the InteractionComponent.onSelectEnd event. |
| SelectStartEventArgs | Arguments used with the InteractionComponent.onSelectStart event. |
| TapEventArgs | Arguments used with the InteractionComponent.onTap event. |
| TargetingDataArgs SPECS | |
| TouchEndEventArgs | Arguments used with the InteractionComponent.onTouchEnd event. |
| TouchMoveEventArgs | Arguments used with the InteractionComponent.onTouchMove event. |
| TouchStartEventArgs | Arguments used with the InteractionComponent.onTouchStart event. |
| TriggerPrimaryEventArgs | Arguments used with the InteractionComponent.onTriggerPrimary event. |
Objects and data
| API | Description |
|---|---|
| GameControllerSession SPECS | Represents an active game controller session. |
| HapticFeedbackSystem | Triggers haptic feedback on the device. |
| KeyboardManager | |
| ManipulateFrameIntersectResult | Result object returned from ManipulateComponent.intersectManipulateFrame. |
| MotionController SPECS | Gives access to motion data and touch events from an external device to Spectacles, as well as haptic feedback requests from Spectacles to an external device. |
| TextInputSystem | Provides access to the device's input system. |
| TouchDataProvider | This provider is returned by global.touchSystem and allows your lens to handle any touches on the screen, and optionally let certain touch types to pass thro… |
Enums
| API | Description |
|---|---|
| HapticFeedbackType | The method in which haptic feedback is provided. |
| KeyModifiers | |
| Keys | |
| ManipulateType | Enum values specifying each type of manipulation. |
| TouchState |