Skip to main content
Version: 5.x

Input Action

The Input Action component is a modular way to map different user inputs (joystick, taps, face events, microphone volume, Wired Params) to high-level actions in your Lens. It centralizes input wiring and lets you compose multiple responses such as moving a character, rotating an object, triggering behaviors, or calling into other components.

Key Features

  • Multiple input sources: Joystick, Interaction Component tap/hover events, Face events, Microphone volume, Wired Params.
  • Modular responses: Move objects/characters, Rotate objects, Trigger Behavior, Call Component APIs, Map scalar to movement.
  • Repurpose Joystick: Use the Character Controller-style joystick UI for movement/rotation actions.
  • Flexible value shaping: Optional remapping and smoothing for scalar inputs.

Usage

To use the Input Action component:

  1. Go to the Asset Library in Lens Studio and search for Input Action in the Custom Components section.
  2. Click Install. The Input Action component will be added to the Asset Browser.
  3. Add the Input Action component to a Scene Object (an empty object is fine).

If you plan to use joystick-driven Movement or Rotation, install the Joystick component from the Asset Library.
If you plan to use Character Controller responses, install the Character Controller component from the Asset Library.

Usage examples

This example shows how to move a character using joystick input:

Component Inputs

InputActionComponent

The main component you add to a Scene Object; it serves as the entry point for configuring all input actions.

PropertyTypeDescription
Action TypeUserActionTypeThe primary type of input action you want to create: Movement, Rotation, Event, or Scalar.
Movement InputMovementInputActionConfigVisible if Action Type is Movement. Contains all settings related to movement input.
Rotation InputRotationInputActionConfigVisible if Action Type is Rotation. Contains all settings related to rotation input.
Discrete InputDiscreteInputActionConfigVisible if Action Type is Event. Contains all settings for event-based (discrete) actions.
Scalar InputScalarInputActionConfigVisible if Action Type is Scalar. Contains all settings for continuous value (scalar) inputs.
Enable Touch BlockingbooleanDisables the default Snapchat gestures, like pinch-to-zoom, for full-screen touch gameplay.
Print WarningsbooleanIf checked, the script prints warning messages to the logger for debugging.

Movement Action Configurations

MovementInputActionConfig

Configures the source of movement input and how the system should respond.

PropertyTypeDescription
Input TypeDirectionInputTypeThe source of the movement input. Currently, only Joystick is supported.
Joystick SettingsJoystickDirectionAdapterConfigVisible if Input Type is Joystick. Settings for the joystick input.
Movement Responses:MovementResponseConfig[]A list of actions to perform in response to the movement input (e.g., move an object).

JoystickDirectionAdapterConfig

Defines how to interpret joystick input for movement.

PropertyTypeDescription
Joystick Input ConfigJoystickInputConfigThe core settings for the joystick component itself.
Constrain to PlanebooleanIf checked, the 2D joystick direction is projected onto a 3D plane for movement in the scene.
Reference CameraCameraVisible if Constrain to Plane is checked. The camera to use as a reference for projecting the movement direction. If not set, the world space is used.
Plane PresetPlanePresetVisible if Constrain to Plane is checked. A preset for the plane to project onto (XZ, XY, or Custom).
Custom Planevec3Visible if Plane Preset is Custom. The normal of the custom plane to project the movement onto.

MovementResponseConfig

Defines a single response to a movement input.

PropertyTypeDescription
Response TypeDirectionResponseTypeThe type of movement response: Move Object or Move Character.
Movement SettingsMoveObjectConfigVisible if Response Type is Move Object. Settings for moving a standard Scene Object.
Character SettingsMoveCharacterConfigVisible if Response Type is Move Character. Settings for moving a Character Controller.

MoveObjectConfig

Settings for the "Move Object" response.

PropertyTypeDescription
Target ObjectSceneObjectThe Scene Object that will be moved.
SpeednumberThe speed at which the object will move.
Movement SpaceMovementSpaceThe coordinate space for the movement (Local or World).

MoveCharacterConfig

Settings for the "Move Character" response.

PropertyTypeDescription
Movement SpeednumberA multiplier for the character's movement speed.
Character ControllerCharacterControllerA reference to the Character Controller script component to be moved.

Rotation Action Configurations

RotationInputActionConfig

Configures the source of rotation input and the corresponding responses.

PropertyTypeDescription
Input TypeRotationInputTypeThe source of the rotation input: Joystick or Gyroscope.
Joystick SettingsJoystickRotationAdapterConfigVisible if Input Type is Joystick. Settings for using a joystick for rotation.
Gyroscope SettingsGyroscopeRotationAdapterConfigVisible if Input Type is Gyroscope. Settings for using the device's gyroscope for rotation.
Rotation Responses:RotationResponseConfig[]A list of actions to perform in response to the rotation input.

JoystickRotationAdapterConfig

Defines how to interpret joystick input for rotation.

PropertyTypeDescription
Joystick Input ConfigJoystickInputConfigThe core settings for the joystick component.
SpeednumberThe speed of the rotation.
Block FlipsbooleanIf checked, prevents the object from rotating upside down (flipping over the Y-axis).

GyroscopeRotationAdapterConfig

Defines how to interpret gyroscope input.

PropertyTypeDescription
Allow Roll RotationbooleanIf checked, allows for "rolling" rotation (like a plane banking).
Invert RotationbooleanIf checked, inverts the rotation input from the gyroscope.
Rotation Blend ModeRotationBlendModeHow the rotation is applied: Additive (accumulates over time) or Absolute (sets directly).

RotationResponseConfig

Defines a single response to a rotation input.

PropertyTypeDescription
Response TypeRotationResponseTypeThe type of rotation response. Currently, only Rotate Object is supported.
Rotation SettingsRotateObjectResponseConfigVisible if Response Type is Rotate Object. Settings for rotating a Scene Object.

RotateObjectResponseConfig

Settings for the "Rotate Object" response.

PropertyTypeDescription
Target ObjectSceneObjectThe Scene Object that will be rotated.
Rotation SpaceRotationSpaceThe coordinate space for the rotation (Local or World).

Discrete (Event) Action Configurations

DiscreteInputActionConfig

Configures event-based triggers and their responses.

PropertyTypeDescription
Input TypeDiscreteInputTypeThe source of the event: Interaction Component or Face Event.
Interaction Component SettingsInteractionComponentDiscreteAdapterConfigVisible if Input Type is Interaction Component. Settings for using an Interaction Component as a trigger.
Face Event SettingsFaceEventDiscreteAdapterConfigVisible if Input Type is Face Event. Settings for using a face gesture as a trigger.
Event Responses:DiscreteResponseConfig[]A list of actions to perform when the event is triggered.

InteractionComponentDiscreteAdapterConfig

Settings for using an Interaction Component as an event source.

PropertyTypeDescription
Interaction ComponentInteractionComponentA reference to the Interaction Component to listen to.
Action TypeInteractionComponentActionTypeThe specific event to listen for (Tap, TouchStart, TouchEnd, onHoverEnter, onHoverExit).

FaceEventDiscreteAdapterConfig

Settings for using face events as a trigger.

PropertyTypeDescription
Face Event TypeFaceEventTypeThe category of face event to use (Smile, Mouth, Kiss, Brows, Face Tracking).
Smile EventnumberVisible if Face Event Type is Smile. The specific smile event (Smile Started, Smile Finished).
Mouth EventnumberVisible if Face Event Type is Mouth. The specific mouth event (Mouth Opened, Mouth Closed).
Kiss EventnumberVisible if Face Event Type is Kiss. The specific kiss event (Kiss Started, Kiss Finished).
Brows EventnumberVisible if Face Event Type is Brows. The specific brows event (Brows Raised, Brows Lowered, etc.).
Face Tracking EventnumberVisible if Face Event Type is Face Tracking. The specific tracking event (Face Found, Face Lost).

DiscreteResponseConfig

Defines a single response to a discrete event.

PropertyTypeDescription
Response TypeDiscreteResponseTypeThe type of response: Character Controller, Component API Call, or Behavior.
Character Controller SettingsCharacterControllerDiscreteResponseConfigVisible if Response Type is Character Controller. Settings for interacting with a Character Controller.
Component API Response ConfigComponentApiResponseConfigVisible if Response Type is Component API Call. Settings for calling a function on another script.
Behavior Response SettingsBehaviorResponseConfigVisible if Response Type is Behavior. Settings for triggering a Behavior script.

CharacterControllerDiscreteResponseConfig

Settings for the "Character Controller" discrete response.

PropertyTypeDescription
Character ControllerCharacterControllerA reference to the Character Controller script component.
Response TypeCharacterControllerDiscreteResponseTypeThe action to perform. Currently, only Set Character Position is supported.
Positionvec3Visible if Response Type is Set Character Position. The world position to move the character to.

ComponentApiResponseConfig

Settings for the "Component API Call" response.

PropertyTypeDescription
ComponentBaseScriptComponentThe script component that contains the method you want to call.
Method NamestringThe name of the method (function) to call on the specified component.

BehaviorResponseConfig

Settings for the "Behavior" response.

PropertyTypeDescription
Behavior Trigger TypeBehaviorResponseTypeThe method for triggering the behavior script: Global Custom Trigger or Manual Trigger.
Custom Trigger NamestringVisible if Behavior Trigger Type is Global Custom Trigger. The name of the global custom trigger to send.
Behavior ScriptBaseScriptComponentVisible if Behavior Trigger Type is Manual Trigger. A reference to the Behavior script whose trigger function will be called.

Scalar Action Configurations

ScalarInputActionConfig

Configures inputs that produce a continuous value (a scalar) and their responses.

PropertyTypeDescription
Input TypeScalarInputTypeThe source of the scalar value: Microphone Volume or Wired Params.
Volume Input SettingsVoiceAdapterConfigVisible if Input Type is Microphone Volume. Settings for using microphone volume as input.
Wired Params Custom Component ConfigWiredParamsAdapterConfigVisible if Input Type is Wired Params. Settings for using a Wired Parameters component as input.
Remap ValuebooleanIf checked, the input value will be remapped to a new range.
Remap SettingsRemapConfigVisible if Remap Value is checked. The settings for remapping the value.
Scalar Responses:ScalarResponseConfig[]A list of actions to perform in response to the scalar value.

VoiceAdapterConfig

Settings for using microphone volume as a scalar input.

PropertyTypeDescription
Microphone Audio AssetAudioTrackAssetA reference to the Microphone Audio asset in your project.
Enable EasingbooleanIf checked, the input value will be smoothed over time.
Easing ConfigScalarEasingConfigVisible if Enable Easing is checked. The settings for the smoothing effect.

ScalarEasingConfig

Settings for smoothing a scalar value.

PropertyTypeDescription
Easing TypeEasingTypeThe type of easing to apply. Currently, only Exponential (lerp) is supported.
Easing FactornumberVisible if Easing Type is Exponential. The amount of smoothing to apply (0.01 to 1). Higher values are less smooth.

WiredParamsAdapterConfig

Instructions for connecting a Wired Parameters component. Does not have any configurable properties.

RemapConfig

Settings for remapping a scalar value from one range to another.

PropertyTypeDescription
Input MinnumberThe minimum expected value from the input source.
Input MaxnumberThe maximum expected value from the input source.
Output MinnumberThe new minimum value to map to.
Output MaxnumberThe new maximum value to map to.
Clamp OutputbooleanIf checked, the output value will be forced to stay within the Output Min and Output Max range.

ScalarResponseConfig

Defines a single response to a scalar input.

PropertyTypeDescription
Response TypeScalarResponseTypeThe type of response: Character Controller or Map To Movement.
Character Controller Response SettingsCharacterControllerResponseConfigVisible if Response Type is Character Controller. Settings for controlling a Character Controller with the scalar value.
Map To Movement Response SettingsMapToMovementResponseConfigVisible if Response Type is Map To Movement. Settings for using the scalar value to drive movement.

CharacterControllerResponseConfig

Settings for the "Character Controller" scalar response.

PropertyTypeDescription
Response TypeResponseTypeThe action to perform. Currently, only Set Movement Speed is supported.
Character Controller ComponentCharacterControllerA reference to the Character Controller script component.
Was this page helpful?
Yes
No