Preparing search index...

    Abstract class representing an element in the Spectacles UIKit.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _colliderCenter: vec3 = ...
    _colliderFitElement: boolean = true
    _colliderSize: vec3 = ...
    _hasError: boolean = false
    _initialized: boolean = false
    _interactableStateMachine: InteractableStateMachine
    _isDragged: boolean = false

    Indicates whether the element is currently being dragged. This property is used to track the drag state of the element.

    _renderOrder: number = 0
    _size: vec3 = ...
    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.

    colliderObject: SceneObject
    colliderShape: BoxShape
    colliderTransform: Transform
    currentPosition: vec3 = ...
    currentScale: vec3 = ...
    enabled: boolean

    If disabled, the Component will stop enacting its behavior.

    isEnabledInHierarchy: boolean

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

    managedComponents: Set<Component> = ...
    managedSceneObjects: Set<SceneObject> = ...
    name: string
    onHoverEnter: PublicApi<void> = ...

    An event that is triggered when a hover interaction starts on the element.

    onHoverExit: PublicApi<void> = ...

    An event that is triggered when a hover interaction ends on the element.

    onInitialized: PublicApi<void> = ...

    A public API event that is triggered when the element is initialized.

    onStateChanged: PublicApi<StateName> = ...

    An event that is triggered whenever the state of the element changes.

    onStateChangedEvent: ReplayEvent<StateName> = ...
    onTriggerDown: PublicApi<void> = ...

    An event that is triggered when a trigger interaction starts on the element.

    onTriggerUp: PublicApi<void> = ...

    An event that is triggered when a trigger interaction ends on the element.

    sceneObject: SceneObject

    The SceneObject this component is on.

    stateName: StateName = StateName.default
    uniqueIdentifier: string
    updatePriority: number

    Accessors

    • get collider(): ColliderComponent

      Gets the ColliderComponent instance associated with this element. The collider is used for detecting interactions or collisions with the element.

      Returns ColliderComponent

      The collider instance.

    • get colliderCenter(): vec3

      Gets the custom center position of the collider. This position is only used when colliderFitElement is false.

      Returns vec3

      The custom collider center position in local space coordinates.

    • set colliderCenter(center: vec3): void

      Sets the custom center position of the collider. This position is only applied when colliderFitElement is false.

      Parameters

      • center: vec3

        The custom collider center position in local space coordinates.

      Returns void

    • get colliderFitElement(): boolean

      Gets whether the collider automatically fits the element's size.

      Returns boolean

      True if the collider fits the element, false if using custom size/position.

    • set colliderFitElement(colliderFitElement: boolean): void

      Sets whether the collider should automatically fit the element's size.

      Parameters

      • colliderFitElement: boolean

        True to make the collider fit the element, false to use custom size/position.

      Returns void

    • get colliderSize(): vec3

      Gets the custom size of the collider. This size is only used when colliderFitElement is false.

      Returns vec3

      The custom collider size in local space coordinates.

    • set colliderSize(size: vec3): void

      Sets the custom size of the collider. This size is only applied when colliderFitElement is false.

      Parameters

      • size: vec3

        The custom collider size in local space coordinates.

      Returns void

    • get contentChildren(): SceneObject[]

      Gets the children of the element that are not managed by the element.

      Returns SceneObject[]

      The children of the element that are not managed by the element.

    • get contentChildrenCount(): number

      Gets the number of children of the element that are not managed by the element.

      Returns number

      The number of children of the element that are not managed by the element.

    • get inactive(): boolean

      Returns boolean

      is inactive or not

    • set inactive(inactive: boolean): void

      Parameters

      • inactive: boolean

        set is inactive or is not inactive

      Returns void

    • get initialized(): boolean

      Indicates whether the element has been initialized.

      Returns boolean

      true if the element is initialized, otherwise false.

    • get interactable(): Interactable

      Gets the interactable property of the element.

      Returns Interactable

      The current interactable instance associated with this element.

    • get isDraggable(): boolean

      Determines whether the element is draggable.

      Returns boolean

      Always returns false, indicating that the element is not draggable.

    • get isToggle(): boolean

      Returns boolean

    • get playAudio(): boolean

      Gets the value indicating whether audio playback is enabled.

      Returns boolean

      true if audio playback is enabled; otherwise, false.

    • set playAudio(playAudio: boolean): void

      Sets the playAudio behavior and initializes the audio component if necessary.

      Parameters

      • playAudio: boolean

        A boolean indicating whether audio should be played. If set to true and the audio component is not already created, a new audio component will be instantiated and attached to the scene object.

      Returns void

    • get playTriggerDownAudio(): boolean

      Gets the value indicating whether trigger down audio playback is enabled.

      Returns boolean

      true if trigger down audio playback is enabled; otherwise, false.

    • set playTriggerDownAudio(playTriggerDownAudio: boolean): void

      Sets the playTriggerDownAudio behavior and initializes the audio component if necessary.

      Parameters

      • playTriggerDownAudio: boolean

        A boolean indicating whether trigger down audio should be played. If set to true and the audio component is not already created, a new audio component will be instantiated and attached to the scene object.

      Returns void

    • get playTriggerUpAudio(): boolean

      Gets the value indicating whether trigger up audio playback is enabled.

      Returns boolean

      true if trigger up audio playback is enabled; otherwise, false.

    • set playTriggerUpAudio(playTriggerUpAudio: boolean): void

      Sets the playTriggerUpAudio behavior and initializes the audio component if necessary.

      Parameters

      • playTriggerUpAudio: boolean

        A boolean indicating whether trigger up audio should be played. If set to true and the audio component is not already created, a new audio component will be instantiated and attached to the scene object.

      Returns void

    • get size(): vec3

      Returns vec3

      current size

    • set size(size: vec3): void

      Parameters

      • size: vec3

        set current size

      Returns void

    • get transform(): Transform

      Gets the transform associated with this element.

      Returns Transform

      The transform of the element.

    • get triggerEndAudioTrack(): AudioTrackAsset

      Gets the audio track to be played at the end of a trigger event.

      Returns AudioTrackAsset

      The audio track asset associated with the trigger end event.

    • set triggerEndAudioTrack(audioTrack: AudioTrackAsset): void

      Sets the audio track to be played at the end of a trigger event.

      Parameters

      Returns void

    • get triggerEndAudioVolume(): number

      Gets the volume level for the trigger end audio.

      Returns number

      The volume level for the trigger end audio.

    • set triggerEndAudioVolume(volume: number): void

      Sets the volume level for the trigger end audio.

      Parameters

      • volume: number

        The desired volume level as a number.

      Returns void

    • get triggerStartAudioTrack(): AudioTrackAsset

      Gets the audio track to be played when the trigger starts.

      Returns AudioTrackAsset

      The audio track asset associated with the trigger start event.

    • set triggerStartAudioTrack(audioTrack: AudioTrackAsset): void

      Sets the audio track to be played when the trigger starts.

      Parameters

      Returns void

    • get triggerStartAudioVolume(): number

      Gets the volume level for the trigger start audio.

      Returns number

      The volume level for the trigger start audio.

    • set triggerStartAudioVolume(volume: number): void

      Sets the volume level for the trigger start audio.

      Parameters

      • volume: number

        The desired audio volume level as a number.

      Returns void

    Methods

    • Returns void

    • Returns void

    • Initializes the element and its associated components. This method ensures that the element is set up properly, including its collider, interactable state, size, and event listeners.

      Returns void

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

      Parameters

      • type: string

      Returns boolean

    • Returns void

    • Returns void

    • Returns void

    • Plays the specified audio track at the given volume.

      Parameters

      • audioTrack: AudioTrackAsset

        The audio track asset to be played.

      • volume: number

        The volume level at which the audio track should be played.

      Returns void

    • Returns void

    • Returns void

    • Returns void

    • Returns void

    • Returns void