Lens Scripting API

    This class provides manipulation capabilities for interactable objects, including translation, rotation, and scaling. It allows configuration of the manipulation root, scale limits, and rotation axes.

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    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.

    beta: number = 0.015

    Speed coefficient of the one-euro filter. Higher values reduce lag during fast movements but may increase jitter. Adjust this parameter after setting minCutoff to minimize lag during quick movements.

    dcutoff: number = 1

    Derivative cutoff frequency for the one-euro filter. Controls how the filter responds to changes in movement speed. Higher values make the filter more responsive to velocity changes.

    enabled: boolean

    If disabled, the Component will stop enacting its behavior.

    enableStretchZ: boolean = true

    Enhances depth manipulation by applying a distance-based multiplier to Z-axis movement. When enabled, objects that are farther away will move greater distances with the same hand movement, making it easier to position distant objects without requiring excessive physical reach.

    maximumScaleFactor: number = 20

    The largest this object can scale up to, relative to its original scale. A value of 2 means it cannot scale larger than twice its original size.

    minCutoff: number = 2

    Minimum cutoff frequency of the one-euro filter. Lower values reduce jitter during slow movements but increase lag. Adjust this parameter first with beta=0 to find a balance that removes jitter while maintaining acceptable responsiveness during slow movements.

    minimumScaleFactor: number = 0.25

    The smallest this object can scale down to, relative to its original scale. A value of 0.5 means it cannot scale smaller than 50% of its original size.

    name: string
    onManipulationEnd: PublicApi<TransformEventArg> = ...

    Callback for when any manipulation ends

    onManipulationStart: PublicApi<TransformEventArg> = ...

    Callback for when any manipulation begins

    onManipulationUpdate: PublicApi<TransformEventArg> = ...

    Callback for when any manipulation updates

    onRotationEnd: PublicApi<RotationEventArg> = ...

    Callback for when rotation has ended

    onRotationStart: PublicApi<RotationEventArg> = ...

    Callback for when rotation begins

    onRotationUpdate: PublicApi<RotationEventArg> = ...

    Callback for when rotation updates each frame

    onScaleEnd: PublicApi<ScaleEventArg> = ...

    Callback for when scale has ended

    onScaleLimitReached: PublicApi<ScaleLimitEventArg> = ...

    Callback for when scale has reached the minimum or maximum limit

    onScaleStart: PublicApi<ScaleEventArg> = ...

    Callback for when scale begins

    onScaleUpdate: PublicApi<ScaleEventArg> = ...

    Callback for when scale updates each frame

    onTranslationEnd: PublicApi<TranslateEventArg> = ...

    Callback for when translation has ended

    onTranslationStart: PublicApi<TranslateEventArg> = ...

    Callback for when translation begins

    onTranslationUpdate: PublicApi<TranslateEventArg> = ...

    Callback for when translation updates each frame

    sceneObject: SceneObject

    The scene object this component is on.

    showRotationProperties: boolean = false

    Controls the visibility of rotation options in the Inspector.

    showStretchZProperties: boolean = false

    Controls the visibility of advanced Z-stretch configuration options in the Inspector. When enabled, shows additional properties that fine-tune the distance-based Z-axis movement multiplier (Z Stretch Factor Min and Z Stretch Factor Max).

    showTranslationProperties: boolean = false

    Controls the visibility of translation options in the Inspector.

    uniqueIdentifier: string
    updatePriority: number
    zStretchFactorMax: number = 12.0

    The maximum multiplier applied to Z-axis movement when using stretch mode. This value is used when objects are far away from the user. Higher values allow faster positioning of distant objects with minimal hand movement.

    zStretchFactorMin: number = 1.0

    The minimum multiplier applied to Z-axis movement when using stretch mode. This value is used when objects are close to the user. Higher values result in more responsive depth movement for nearby objects.

    Accessors

    • get enableXTranslation(): boolean

      Returns if translation along world X-axis is enabled.

      Returns boolean

    • set enableXTranslation(enabled: boolean): void

      Set if translation along world X-axis is enabled.

      Parameters

      • enabled: boolean

      Returns void

    • get enableYTranslation(): boolean

      Returns if translation along world Y-axis is enabled.

      Returns boolean

    • set enableYTranslation(enabled: boolean): void

      Set if translation along world Y-axis is enabled.

      Parameters

      • enabled: boolean

      Returns void

    • get enableZTranslation(): boolean

      Returns if translation along world Z-axis is enabled.

      Returns boolean

    • set enableZTranslation(enabled: boolean): void

      Set if translation along world Z-axis is enabled.

      Parameters

      • enabled: boolean

      Returns void

    • get rotationAxis(): RotationAxis

      Get if rotation occurs about all axes or a single world axis (x,y,z) when using to two hands..

      Returns RotationAxis

    • set rotationAxis(axis: RotationAxis): void

      Set if rotation occurs about all axes or a single world axis (x,y,z) when using to two hands.

      Parameters

      Returns void

    Methods

    • Returns true if any of rotation x, y, or z is enabled

      Returns boolean

    • Returns true if any of scale x, y, or z is enabled

      Returns boolean

    • Returns true translation is enabled

      Returns boolean

    • Gets the transform of the root of the manipulated object(s).

      Returns Transform

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

      Parameters

      • type: string

      Returns boolean

    • Returns void

    • Resets the interactable's position

      Parameters

      • local: boolean = false

      Returns void

    • Resets the interactable's rotation

      Parameters

      • local: boolean = false

      Returns void

    • Resets the interactable's scale

      Parameters

      • local: boolean = false

      Returns void

    • Resets the interactable's transform

      Parameters

      • local: boolean = false

      Returns void

    • Toggle for allowing an object to rotate

      Parameters

      • enabled: boolean

      Returns void

    • Toggle for allowing an object to scale

      Parameters

      • enabled: boolean

      Returns void

    • Toggle for allowing an object to translate

      Parameters

      • enabled: boolean

      Returns void

    • Sets the transform of the passed SceneObject as the root of the manipulated object(s).

      Parameters

      Returns void

    MMNEPVFCICPMFPCPTTAAATR