Lens Scripting API

    This class provides functionality to position a SceneObject relative to the user's head movements. It allows configuration of distance, translation, and rotation settings to control how the SceneObject follows or stays fixed as the user moves their head. This creates a balanced experience between head-locked objects (which move with the head) and world-space objects (which stay fixed in the environment).

    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.

    enabled: boolean

    If disabled, the Component will stop enacting its behavior.

    name: string
    sceneObject: SceneObject

    The scene object this component is on.

    uniqueIdentifier: string
    updatePriority: number

    Accessors

    • get distance(): number

      Get how far the SceneObject will be from the user.

      Returns number

    • set distance(distance: number): void

      Set how far the SceneObject will be from the user.

      Parameters

      • distance: number

      Returns void

    • get lockedPitch(): boolean

      Get if the SceneObject will follow when the user moves their head along the pitch-axis (looking up/down)

      Returns boolean

    • set lockedPitch(locked: boolean): void

      Set if the SceneObject will follow when the user moves their head along the pitch-axis (looking up/down)

      Parameters

      • locked: boolean

      Returns void

    • get lockedYaw(): boolean

      Get if the SceneObject will follow when the user moves their head along the yaw-axis (looking left/right)

      Returns boolean

    • set lockedYaw(locked: boolean): void

      Set if the SceneObject will follow when the user moves their head along the yaw-axis (looking left/right)

      Parameters

      • locked: boolean

      Returns void

    • get pitchBufferDegrees(): number

      Get how many degrees of leeway along each direction (up/down) before change starts to occur.

      Returns number

    • set pitchBufferDegrees(degrees: number): void

      Set how many degrees of leeway along each direction (up/down) before change starts to occur.

      Parameters

      • degrees: number

      Returns void

    • get pitchEasing(): number

      Get how fast the SceneObject will follow along the pitch-axis, 0.1 for delayed follow, 1 for instant follow.

      Returns number

    • set pitchEasing(easing: number): void

      Set how fast the SceneObject will follow along the pitch-axis, 0.1 for delayed follow, 1 for instant follow.

      Parameters

      • easing: number

      Returns void

    • get pitchOffsetDegrees(): number

      Get how many degrees of offset from the center point should the target sit. Positive values place the element below the center.

      Returns number

    • set pitchOffsetDegrees(degrees: number): void

      Set how many degrees of offset from the center point should the target sit. Positive values place the element below the center.

      Parameters

      • degrees: number

      Returns void

    • get translationBuffer(): number

      Get the magnitude of change (in centimeters) needed to activate a translation for the target to follow the user's head translation.

      Returns number

    • set translationBuffer(buffer: number): void

      Set the magnitude of change (in centimeters) needed to activate a translation for the target to follow the user's head translation. To keep the SceneObject from 'wobbling' when the user has an unstable head, a small buffer is recommended rather than 0.

      Parameters

      • buffer: number

      Returns void

    • get xzEasing(): number

      Get how fast the SceneObject will follow along the XZ-plane, 0.1 for delayed follow, 1 for instant follow.

      Returns number

    • set xzEasing(easing: number): void

      Set how fast the SceneObject will follow along the XZ-plane, 0.1 for delayed follow, 1 for instant follow.

      Parameters

      • easing: number

      Returns void

    • get xzEnabled(): boolean

      Get if the SceneObject will follow when the user moves their head along XZ-plane. For most cases, this should stay enabled.

      Returns boolean

    • set xzEnabled(enabled: boolean): void

      Sets if the SceneObject will follow when the user moves their head along XZ-plane. For most cases, this should stay enabled.

      Parameters

      • enabled: boolean

      Returns void

    • get yawBufferDegrees(): number

      Get how many degrees of leeway along each direction (left/right) before change starts to occur.

      Returns number

    • set yawBufferDegrees(degrees: number): void

      Set how many degrees of leeway along each direction (left/right) before change starts to occur.

      Parameters

      • degrees: number

      Returns void

    • get yawEasing(): number

      Get how fast the SceneObject will follow along the yaw-axis, 0.1 for delayed follow, 1 for instant follow.

      Returns number

    • set yawEasing(easing: number): void

      Set how fast the SceneObject will follow along the yaw-axis, 0.1 for delayed follow, 1 for instant follow.

      Parameters

      • easing: number

      Returns void

    • get yawOffsetDegrees(): number

      Get how many degrees of offset from the center point should the target sit. Positive values place the element to the left.

      Returns number

    • set yawOffsetDegrees(degrees: number): void

      Set how many degrees of offset from the center point should the target sit. Positive values place the element to the left.

      Parameters

      • degrees: number

      Returns void

    • get yEasing(): number

      Get how fast the SceneObject will follow along the Y-axis, 0.1 for delayed follow, 1 for instant follow.

      Returns number

    • set yEasing(easing: number): void

      Set how fast the SceneObject will follow along the Y-axis, 0.1 for delayed follow, 1 for instant follow.

      Parameters

      • easing: number

      Returns void

    • get yEnabled(): boolean

      Get if the SceneObject will follow when the user moves their head along Y-axis. For most cases, this should stay enabled.

      Returns boolean

    • set yEnabled(enabled: boolean): void

      Set if the SceneObject will follow when the user moves their head along Y-axis. For most cases, this should stay enabled.

      Parameters

      • enabled: boolean

      Returns void

    Methods

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

      Parameters

      • type: string

      Returns boolean

    • Returns void

    • Snaps the object to its exact desired position, regardless of easing, unlocks, buffers, etc. Should be used after modifying values that affect the desired position (such as offset, distance) to snap the object into place without having a strange path.

      Returns void

    MMNEPVFCICPMFPCPTTAAATR