Class: Input
Defined in: src/input/Input.ts:44
The XRInput class holds all the controllers and performs raycasts through the scene each frame.
Constructors
Constructor
new Input():
Input
Returns
Input
Properties
activeControllers
activeControllers:
ActiveControllers
Defined in: src/input/Input.ts:59
controllerGrips
controllerGrips:
Group<Object3DEventMap>[] =[]
Defined in: src/input/Input.ts:47
controllers
controllers:
Controller[] =[]
Defined in: src/input/Input.ts:46
controllersEnabled
controllersEnabled:
boolean=true
Defined in: src/input/Input.ts:55
gamepadController
gamepadController:
GamepadController
Defined in: src/input/Input.ts:54
gazeController
gazeController:
GazeController
Defined in: src/input/Input.ts:52
hands
hands:
XRHandSpace[] =[]
Defined in: src/input/Input.ts:48
initialized
initialized:
boolean=false
Defined in: src/input/Input.ts:50
intersections
intersections:
never[] =[]
Defined in: src/input/Input.ts:58
intersectionsForController
intersectionsForController:
Map<Controller,Intersection<Object3D<Object3DEventMap>>[]>
Defined in: src/input/Input.ts:57
leftController?
optionalleftController:Controller
Defined in: src/input/Input.ts:60
listeners
listeners:
Map<any,any>
Defined in: src/input/Input.ts:56
mouseController
mouseController:
MouseController
Defined in: src/input/Input.ts:53
options
options:
Options
Defined in: src/input/Input.ts:45
pivotsEnabled
pivotsEnabled:
boolean=false
Defined in: src/input/Input.ts:51
raycaster
raycaster:
Raycaster
Defined in: src/input/Input.ts:49
reticles
reticles:
Reticles
Defined in: src/input/Input.ts:62
rightController?
optionalrightController:Controller
Defined in: src/input/Input.ts:61
scene?
optionalscene:Scene<Object3DEventMap>
Defined in: src/input/Input.ts:63
Methods
addObject()
addObject(
obj):void
Defined in: src/input/Input.ts:182
Adds an object to both controllers by creating a new group and cloning it.
Parameters
obj
The object to add to each controller.
Returns
void
addReticles()
addReticles():
void
Defined in: src/input/Input.ts:208
Adds reticles to the controllers and scene, with initial visibility set to false.
Returns
void
bindKeyDown()
bindKeyDown(
event):void
Defined in: src/input/Input.ts:371
Parameters
event
(event) => void
Returns
void
bindKeyUp()
bindKeyUp(
event):void
Defined in: src/input/Input.ts:375
Parameters
event
(event) => void
Returns
void
bindListener()
bindListener(
listenerName,listener):void
Defined in: src/input/Input.ts:288
Binds a listener to both controllers.
Parameters
listenerName
keyof ControllerEventMap
Event name
listener
(event) => void
Function to call
Returns
void
bindSelect()
bindSelect(
event):void
Defined in: src/input/Input.ts:346
Binds an event listener to handle 'select' events for both controllers.
Parameters
event
(event) => void
The event listener function.
Returns
void
bindSelectEnd()
bindSelectEnd(
event):void
Defined in: src/input/Input.ts:338
Binds an event listener to handle 'selectend' events for both controllers.
Parameters
event
(event) => void
The event listener function.
Returns
void
bindSelectStart()
bindSelectStart(
event):void
Defined in: src/input/Input.ts:330
Binds an event listener to handle 'selectstart' events for both controllers.
Parameters
event
(event) => void
The event listener function.
Returns
void
bindSqueeze()
bindSqueeze(
event):void
Defined in: src/input/Input.ts:367
Parameters
event
(event) => void
Returns
void
bindSqueezeEnd()
bindSqueezeEnd(
event):void
Defined in: src/input/Input.ts:363
Binds an event listener to handle 'squeezeend' events for both controllers.
Parameters
event
(event) => void
The event listener function.
Returns
void
bindSqueezeStart()
bindSqueezeStart(
event):void
Defined in: src/input/Input.ts:355
Binds an event listener to handle 'squeezestart' events for both controllers.
Parameters
event
(event) => void
The event listener function.
Returns
void
defaultOnConnected()
defaultOnConnected(
event):void
Defined in: src/input/Input.ts:251
Parameters
event
ControllerEvent
Returns
void
defaultOnDisconnected()
defaultOnDisconnected(
event):void
Defined in: src/input/Input.ts:266
Parameters
event
ControllerEvent
Returns
void
defaultOnSelectEnd()
defaultOnSelectEnd(
event):void
Defined in: src/input/Input.ts:236
Default action to handle the end of a selection, setting the selecting state to false.
Parameters
event
ControllerEvent
Returns
void
defaultOnSelectStart()
defaultOnSelectStart(
event):void
Defined in: src/input/Input.ts:225
Default action to handle the start of a selection, setting the selecting state to true.
Parameters
event
ControllerEvent
Returns
void
defaultOnSqueezeEnd()
defaultOnSqueezeEnd(
event):void
Defined in: src/input/Input.ts:246
Parameters
event
ControllerEvent
Returns
void
defaultOnSqueezeStart()
defaultOnSqueezeStart(
event):void
Defined in: src/input/Input.ts:241
Parameters
event
ControllerEvent
Returns
void
disableControllers()
disableControllers():
void
Defined in: src/input/Input.ts:529
Returns
void
disableGazeController()
disableGazeController():
void
Defined in: src/input/Input.ts:524
Returns
void
dispatchEvent()
dispatchEvent(
event):void
Defined in: src/input/Input.ts:317
Parameters
event
ControllerEvent
Returns
void
enableControllers()
enableControllers():
void
Defined in: src/input/Input.ts:540
Returns
void
enableGazeController()
enableGazeController():
void
Defined in: src/input/Input.ts:519
Returns
void
enablePivots()
enablePivots():
void
Defined in: src/input/Input.ts:195
Creates a pivot point for each hand, primarily used as a reference point.
Returns
void
get()
get(
id):Object3D
Defined in: src/input/Input.ts:174
Retrieves the controller object by its ID.
Parameters
id
number
The ID of the controller.
Returns
The controller with the specified ID.
init()
init(
__namedParameters):void
Defined in: src/input/Input.ts:69
Initializes an instance with XR controllers, grips, hands, raycaster, and default options. Only called by Core.
Parameters
__namedParameters
options
renderer
scene
systemsGroup
XRSystems
Returns
void
intersectObject()
intersectObject(
obj):Intersection<Object3D<Object3DEventMap>>[]
Defined in: src/input/Input.ts:421
Finds intersections with an object from either controller.
Parameters
obj
The object to intersect.
Returns
Intersection<Object3D<Object3DEventMap>>[]
Array of intersection points, if any.
intersectObjectByController()
intersectObjectByController(
controller,obj):Intersection<Object3D<Object3DEventMap>>[]
Defined in: src/input/Input.ts:393
Finds intersections between a controller's ray and a specified object.
Parameters
controller
The controller casting the ray.
obj
The object to intersect.
Returns
Intersection<Object3D<Object3DEventMap>>[]
Array of intersection points, if any.
intersectObjectByEvent()
intersectObjectByEvent(
event,obj):Intersection<Object3D<Object3DEventMap>>[]
Defined in: src/input/Input.ts:409
Finds intersections based on an event's target controller and a specified object.
Parameters
event
ControllerEvent
The event containing the controller reference.
obj
The object to intersect.
Returns
Intersection<Object3D<Object3DEventMap>>[]
Array of intersection points, if any.
performRaycastOnScene()
performRaycastOnScene(
controller):void
Defined in: src/input/Input.ts:545
Parameters
controller
Controller
Returns
void
setRaycasterFromController()
setRaycasterFromController(
controller):void
Defined in: src/input/Input.ts:461
Sets the raycaster's origin and direction from any Object3D that
represents a controller. This replaces the non-standard
setFromXRController.
Parameters
controller
The controller to cast a ray from.
Returns
void
unbindKeyDown()
unbindKeyDown(
event):void
Defined in: src/input/Input.ts:379
Parameters
event
(event) => void
Returns
void
unbindKeyUp()
unbindKeyUp(
event):void
Defined in: src/input/Input.ts:383
Parameters
event
(event) => void
Returns
void
unbindListener()
unbindListener(
listenerName,listener):void
Defined in: src/input/Input.ts:301
Parameters
listenerName
keyof ControllerEventMap
listener
(event) => void
Returns
void
update()
update():
void
Defined in: src/input/Input.ts:435
Returns
void
updateController()
updateController(
controller):void
Defined in: src/input/Input.ts:443
Parameters
controller
Controller
Returns
void
updateReticleFromIntersections()
updateReticleFromIntersections(
controller):void
Defined in: src/input/Input.ts:470
Parameters
controller
Controller
Returns
void