Class XRWindowsMotionController
Hierarchy
-
WindowsMotionController
- XRWindowsMotionController
Implements
Index
Constructors
Properties
- browser
Gamepad - controller
Type - device
Position - device
Rotation Quaternion - device
Scale Factor - hand
- id
- index
- isXR
- on
Main Button State Changed Observable - on
Pad State Changed Observable - on
Pad Values Changed Observable - on
Secondary Button State Changed Observable - on
Thumbstick State Changed Observable - on
Thumbstick Values Changed Observable - on
Trackpad Changed Observable - on
Trackpad Values Changed Observable - on
Trigger State Changed Observable - pad
- position
- raw
Pose - rotation
Quaternion - thumbstick
Values - trackpad
- type
- DUALSHOCK
- GAMEPAD
- GAMEPAD_
ID_ PREFIX - GENERIC
- MODEL_
BASE_ URL - MODEL_
LEFT_ FILENAME - MODEL_
RIGHT_ FILENAME - POINTING_
POSE - POSE_
ENABLED - XBOX
Accessors
Methods
Constructors
constructor
-
Construct a new XR-Based windows motion controller
Parameters
-
gamepadInfo: any
the gamepad object from the browser
Returns XRWindowsMotionController
-
Properties
browser GamepadSearch playground for browserGamepad
The browser gamepad
controller TypeSearch playground for controllerType
The type of controller (Eg. Windows mixed reality)
device PositionSearch playground for devicePosition
The device position in babylon space
device Rotation QuaternionSearch playground for deviceRotationQuaternion
The device rotation in babylon space
device Scale FactorSearch playground for deviceScaleFactor
The scale factor of the device in babylon space
handSearch playground for hand
'left' or 'right', see https://w3c.github.io/gamepad/extensions.html#gamepadhand-enum
idSearch playground for id
The id of the gamepad
indexSearch playground for index
The index of the gamepad
isXRSearch playground for isXR
If the controller is used in a webXR session
on Main Button State Changed ObservableSearch playground for onMainButtonStateChangedObservable
Fired when the main button state has changed
on Pad State Changed ObservableSearch playground for onPadStateChangedObservable
Fired when the pad state has changed
on Pad Values Changed ObservableSearch playground for onPadValuesChangedObservable
Fired when controllers stick values have changed
on Secondary Button State Changed ObservableSearch playground for onSecondaryButtonStateChangedObservable
Fired when the secondary button state has changed
on Thumbstick State Changed ObservableSearch playground for onThumbstickStateChangedObservable
Fired when the thumbstick on this controller is clicked
on Thumbstick Values Changed ObservableSearch playground for onThumbstickValuesChangedObservable
Fired when the thumbstick on this controller is modified
on Trackpad Changed ObservableSearch playground for onTrackpadChangedObservable
Fired when the touchpad button on this controller is modified
on Trackpad Values Changed ObservableSearch playground for onTrackpadValuesChangedObservable
Fired when the touchpad values on this controller are modified
on Trigger State Changed ObservableSearch playground for onTriggerStateChangedObservable
Fired when the trigger state has changed
padSearch playground for pad
X and Y axis corresponding to the controllers joystick
positionSearch playground for position
(Likely devicePosition should be used instead) The device position in its room space
raw PoseSearch playground for rawPose
The raw pose from the device
rotation QuaternionSearch playground for rotationQuaternion
(Likely deviceRotationQuaternion should be used instead) The device rotation in its room space
thumbstick ValuesSearch playground for thumbstickValues
holds the thumbstick values (X,Y)
trackpadSearch playground for trackpad
The current x and y values of this controller's trackpad
typeSearch playground for type
Specifies what type of gamepad this represents
Static DUALSHOCKSearch playground for DUALSHOCK
Represents an Dual Shock controller
Static GAMEPADSearch playground for GAMEPAD
Represents a gamepad controller
Static Readonly GAMEPAD_ ID_ PREFIXSearch playground for GAMEPAD_ID_PREFIX
The controller name prefix for this controller type
Static GENERICSearch playground for GENERIC
Represents a generic controller
Static MODEL_ BASE_ URLSearch playground for MODEL_BASE_URL
The base url used to load the left and right controller models
Static MODEL_ LEFT_ FILENAMESearch playground for MODEL_LEFT_FILENAME
The name of the left controller model file
Static MODEL_ RIGHT_ FILENAMESearch playground for MODEL_RIGHT_FILENAME
The name of the right controller model file
Static Readonly POINTING_ POSESearch playground for POINTING_POSE
Name of the child mesh that can be used to cast a ray from the controller
Static POSE_ ENABLEDSearch playground for POSE_ENABLED
Represents a pose-enabled controller
Static XBOXSearch playground for XBOX
Represents an XBox controller
Accessors
default Model
-
The default controller model for the controller
Returns Nullable<AbstractMesh>
is Connected
-
Specifies if the gamepad has been connected
Returns boolean
left Stick
-
Gets the left joystick
Returns StickValues
-
Sets the left joystick values
Parameters
-
newValues: StickValues
Returns any
-
mesh
-
The mesh that is attached to the controller
Returns Nullable<AbstractMesh>
on Grip Button State Changed Observable
-
Fired when the grip button on this controller is modified
Returns Observable<ExtendedGamepadButton>
on Menu Button State Changed Observable
-
Fired when the menu button on this controller is modified
Returns Observable<ExtendedGamepadButton>
on Thumbstick Button State Changed Observable
-
Fired when the thumbstick button on this controller is modified here to prevent breaking changes
Returns Observable<ExtendedGamepadButton>
on Touchpad Button State Changed Observable
-
Fired when the touchpad button on this controller is modified
Returns Observable<ExtendedGamepadButton>
on Touchpad Values Changed Observable
-
Fired when the touchpad values on this controller are modified
Returns Observable<StickValues>
on Trigger Button State Changed Observable
-
Fired when the trigger on this controller is modified
Returns Observable<ExtendedGamepadButton>
right Stick
-
Gets the right joystick
Returns StickValues
-
Sets the right joystick value
Parameters
-
newValues: StickValues
Returns any
-
Methods
attach ToMeshSearch playground for attachToMesh
-
Attaches a mesh to the controller
Parameters
-
mesh: AbstractMesh
the mesh to be attached
Returns void
-
attach ToPose Controlled CameraSearch playground for attachToPoseControlledCamera
-
Attaches the controllers mesh to a camera
Parameters
-
camera: TargetCamera
the camera the mesh should be attached to
Returns void
-
disposeSearch playground for dispose
-
Disposes the class with joy
Returns void
get Forward RaySearch playground for getForwardRay
-
Gets the ray of the controller in the direction the controller is pointing
Parameters
-
Optional length: number
the length the resulting ray should be
Returns Ray
a ray in the direction the controller is pointing
-
init Controller MeshSearch playground for initControllerMesh
-
Implements abstract method on WebVRController class, loading controller meshes and calling this.attachToMesh if successful.
Parameters
-
scene: Scene
scene in which to add meshes
-
Optional meshLoaded: (mesh: AbstractMesh) => void
optional callback function that will be called if the mesh loads successfully.
-
-
Parameters
-
mesh: AbstractMesh
Returns void
-
-
-
-
Optional forceDefault: boolean
Returns void
-
on Button State ChangeSearch playground for onButtonStateChange
-
Fired when a controller button's state has changed
Parameters
-
callback: (controlledIndex: number, buttonIndex: number, state: ExtendedGamepadButton) => void
the callback containing the button that was modified
-
-
Parameters
-
controlledIndex: number
-
buttonIndex: number
-
state: ExtendedGamepadButton
Returns void
-
-
-
Returns void
-
onleftstickchangedSearch playground for onleftstickchanged
-
Callback triggered when the left joystick has changed
Parameters
-
callback: (values: StickValues) => void
-
-
Parameters
-
values: StickValues
Returns void
-
-
-
Returns void
-
onrightstickchangedSearch playground for onrightstickchanged
-
Callback triggered when the right joystick has changed
Parameters
-
callback: (values: StickValues) => void
-
-
Parameters
-
values: StickValues
Returns void
-
-
-
Returns void
-
updateSearch playground for update
-
Called once per frame by the engine.
Returns void
update From DeviceSearch playground for updateFromDevice
-
Updates the state of the pose enbaled controller based on the raw pose data from the device
Parameters
-
poseData: DevicePose
raw pose fromthe device
Returns void
-
This class represents a new windows motion controller in XR.