Class DaydreamController
Hierarchy
-
WebVRController
- DaydreamController
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
Trigger State Changed Observable - pad
- position
- raw
Pose - rotation
Quaternion - type
- DUALSHOCK
- GAMEPAD
- GAMEPAD_
ID_ PREFIX - GENERIC
- MODEL_
BASE_ URL - MODEL_
FILENAME - POINTING_
POSE - POSE_
ENABLED - XBOX
Accessors
Methods
Constructors
constructor
-
Creates a new DaydreamController from a gamepad
Parameters
-
vrGamepad: any
the gamepad that the controller should be created from
Returns DaydreamController
-
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 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
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
Gamepad Id prefix used to identify Daydream Controller.
Static GENERICSearch playground for GENERIC
Represents a generic controller
Static MODEL_ BASE_ URLSearch playground for MODEL_BASE_URL
Base Url for the controller model.
Static MODEL_ FILENAMESearch playground for MODEL_FILENAME
File name for the controller model.
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>
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 of th webVRCOntroller
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
-
-
-
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
-
Updates the state of the controller and mesh based on the current position and rotation of the controller
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
-
Google Daydream controller