Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WebXRControllerComponent

This class represents a single component (for example button or thumbstick) of a motion controller

Hierarchy

  • WebXRControllerComponent

Implements

Index

Constructors

constructor

  • Creates a new component for a motion controller. It is created by the motion controller itself

    Parameters

    • id: string

      the id of this component

    • type: MotionControllerComponentType

      the type of the component

    • Optional _buttonIndex: number

      index in the buttons array of the gamepad

    • Optional _axesIndices: number[]

      indices of the values in the axes array of the gamepad

    Returns WebXRControllerComponent

Properties

idSearch playground for id

id: string

the id of this component

onAxisValueChangedObservableSearch playground for onAxisValueChangedObservable

onAxisValueChangedObservable: Observable<{ x: number; y: number }>

If axes are available for this component (like a touchpad or thumbstick) the observers will be notified when the axes data changes

onButtonStateChangedObservableSearch playground for onButtonStateChangedObservable

onButtonStateChangedObservable: Observable<WebXRControllerComponent>

Observers registered here will be triggered when the state of a button changes State change is either pressed / touched / value

typeSearch playground for type

the type of the component

Static BUTTON_TYPESearch playground for BUTTON_TYPE

button component type

Static SQUEEZE_TYPESearch playground for SQUEEZE_TYPE

squeeze component type

Static THUMBSTICK_TYPESearch playground for THUMBSTICK_TYPE

Thumbstick component type

Static TOUCHPAD_TYPESearch playground for TOUCHPAD_TYPE

Touchpad component type

Static TRIGGER_TYPESearch playground for TRIGGER_TYPE

trigger component type

Accessors

axes

  • The current axes data. If this component has no axes it will still return an object { x: 0, y: 0 }

    Returns IWebXRMotionControllerAxesValue

changes

  • Get the changes. Elements will be populated only if they changed with their previous and current value

    Returns IWebXRMotionControllerComponentChanges

hasChanges

  • get hasChanges(): boolean
  • Return whether or not the component changed the last frame

    Returns boolean

pressed

  • get pressed(): boolean
  • is the button currently pressed

    Returns boolean

touched

  • get touched(): boolean
  • is the button currently touched

    Returns boolean

value

  • get value(): number
  • Get the current value of this component

    Returns number

Methods

disposeSearch playground for dispose

  • dispose(): void
  • Dispose this component

    Returns void

isAxesSearch playground for isAxes

  • isAxes(): boolean
  • Are there axes correlating to this component

    Returns boolean

    true is axes data is available

isButtonSearch playground for isButton

  • isButton(): boolean
  • Is this component a button (hence - pressable)

    Returns boolean

    true if can be pressed

updateSearch playground for update

  • update this component using the gamepad object it is in. Called on every frame

    Parameters

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method