WebXRControllerComponent

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

Hierarchy

  • WebXRControllerComponent

Implements

Index

Constructors

constructor

Find examples in Playground
  • 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

id

Find examples in Playground
id: string

the id of this component

onAxisValueChangedObservable

Find examples in Playground
onAxisValueChangedObservable: Observable<object>

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

onButtonStateChangedObservable

Find examples in Playground
onButtonStateChangedObservable: Observable<WebXRControllerComponent>

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

type

Find examples in Playground

the type of the component

Static BUTTON_TYPE

Find examples in Playground

button component type

Static SQUEEZE_TYPE

Find examples in Playground

squeeze component type

Static THUMBSTICK_TYPE

Find examples in Playground

Thumbstick component type

Static TOUCHPAD_TYPE

Find examples in Playground

Touchpad component type

Static TRIGGER_TYPE

Find examples in Playground

trigger component type

Accessors

axes

Find examples in Playground

changes

Find examples in Playground

hasChanges

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

    Returns boolean

pressed

Find examples in Playground
  • get pressed(): boolean
  • is the button currently pressed

    Returns boolean

touched

Find examples in Playground
  • get touched(): boolean
  • is the button currently touched

    Returns boolean

value

Find examples in Playground
  • get value(): number
  • Get the current value of this component

    Returns number

Methods

dispose

Find examples in Playground
  • dispose(): void

isAxes

Find examples in Playground
  • isAxes(): boolean
  • Are there axes correlating to this component

    Returns boolean

    true is axes data is available

isButton

Find examples in Playground
  • isButton(): boolean
  • Is this component a button (hence - pressable)

    Returns boolean

    true if can be pressed

update

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

    Parameters

    Returns void

Generated using TypeDoc