Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Hierarchy

  • WebXRControllerComponent

Implements

Index

Constructors

  • 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: string

the id of this component

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

onButtonStateChangedObservable: Observable<WebXRControllerComponent>

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

the type of the component

button component type

squeeze component type

Thumbstick component type

Touchpad component type

trigger component type

Accessors

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

    Returns IWebXRMotionControllerAxesValue

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

    Returns IWebXRMotionControllerComponentChanges

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

    Returns boolean

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

    Returns boolean

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

    Returns boolean

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

    Returns number

Methods

  • dispose(): void
  • Dispose this component

    Returns void

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

    Returns boolean

    true is axes data is available

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

    Returns boolean

    true if can be pressed

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

    Parameters

    Returns void

Legend

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

Settings

Theme