Class WebXRControllerComponent
Implements
Constructors
constructor
-
new WebXRControllerComponent(
id: string,
type: MotionControllerComponentType,
_buttonIndex?: number,
_axesIndices?: number[],
): WebXRControllerComponentCreates 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
- _buttonIndex: number = -1
index in the buttons array of the gamepad
- _axesIndices: number[] = []
indices of the values in the axes array of the gamepad
Returns WebXRControllerComponent
- id: string
Properties
id
the id of this component
on Axis Value Changed Observable
If axes are available for this component (like a touchpad or thumbstick) the observers will be notified when the axes data changes
on Button State Changed Observable
Observers registered here will be triggered when the state of a button changes State change is either pressed / touched / value
type
the type of the component
StaticBUTTON_ TYPE
button component type
StaticSQUEEZE_ TYPE
squeeze component type
StaticTHUMBSTICK_ TYPE
Thumbstick component type
StaticTOUCHPAD_ TYPE
Touchpad component type
StaticTRIGGER_ 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
has Changes
-
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
dispose
-
Dispose this component
Returns void
is Axes
-
Are there axes correlating to this component
Returns boolean
true is axes data is available
is Button
-
Is this component a button (hence - pressable)
Returns boolean
true if can be pressed
update
-
update this component using the gamepad object it is in. Called on every frame
Parameters
- nativeController: IMinimalMotionControllerObject
the native gamepad controller object
Returns void
- nativeController: IMinimalMotionControllerObject
This class represents a single component (for example button or thumbstick) of a motion controller