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

onAxisValueChanged

Find examples in Playground
onAxisValueChanged: Observable<object>

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

onButtonStateChanged

Find examples in Playground
onButtonStateChanged: 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 SQUEEZE

Find examples in Playground
SQUEEZE: string

squeeze component type

Static THUMBSTICK

Find examples in Playground
THUMBSTICK: string

Thumbstick component type

Static TOUCHPAD

Find examples in Playground
TOUCHPAD: string

Touchpad component type

Static TRIGGER

Find examples in Playground
TRIGGER: string

trigger component type

Accessors

axes

Find examples in Playground

changes

Find examples in Playground

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