Class: Input
Defined in: src/input/Input.ts:43
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:57
controllerGrips
controllerGrips:
Group<Object3DEventMap>[] =[]
Defined in: src/input/Input.ts:46
controllers
controllers:
Controller[] =[]
Defined in: src/input/Input.ts:45
controllersEnabled
controllersEnabled:
boolean=true
Defined in: src/input/Input.ts:53
gazeController
gazeController:
GazeController
Defined in: src/input/Input.ts:51
hands
hands:
XRHandSpace[] =[]
Defined in: src/input/Input.ts:47
initialized
initialized:
boolean=false
Defined in: src/input/Input.ts:49
intersections
intersections:
never[] =[]
Defined in: src/input/Input.ts:56
intersectionsForController
intersectionsForController:
Map<Controller,Intersection<Object3D<Object3DEventMap>>[]>
Defined in: src/input/Input.ts:55
leftController?
optionalleftController:Controller
Defined in: src/input/Input.ts:58
listeners
listeners:
Map<any,any>
Defined in: src/input/Input.ts:54
mouseController
mouseController:
MouseController
Defined in: src/input/Input.ts:52
options
options:
Options
Defined in: src/input/Input.ts:44
pivotsEnabled
pivotsEnabled:
boolean=false
Defined in: src/input/Input.ts:50
raycaster
raycaster:
Raycaster
Defined in: src/input/Input.ts:48
reticles
reticles:
Reticles
Defined in: src/input/Input.ts:60
rightController?
optionalrightController:Controller
Defined in: src/input/Input.ts:59
scene?
optionalscene:Scene<Object3DEventMap>
Defined in: src/input/Input.ts:61
Methods
addObject()
addObject(
obj):void
Defined in: src/input/Input.ts:178
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:204
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:367
Parameters
event
(event) => void
Returns
void
bindKeyUp()
bindKeyUp(
event):void
Defined in: src/input/Input.ts:371
Parameters
event
(event) => void
Returns
void
bindListener()
bindListener(
listenerName,listener):void
Defined in: src/input/Input.ts:284
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:342
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:334
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:326
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:363
Parameters
event
(event) => void
Returns
void
bindSqueezeEnd()
bindSqueezeEnd(
event):void
Defined in: src/input/Input.ts:359
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:351
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:247
Parameters
event
ControllerEvent
Returns
void
defaultOnDisconnected()
defaultOnDisconnected(
event):void
Defined in: src/input/Input.ts:262
Parameters
event
ControllerEvent
Returns
void
defaultOnSelectEnd()
defaultOnSelectEnd(
event):void
Defined in: src/input/Input.ts:232
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:221
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:242
Parameters
event
ControllerEvent
Returns
void
defaultOnSqueezeStart()
defaultOnSqueezeStart(
event):void
Defined in: src/input/Input.ts:237
Parameters
event
ControllerEvent
Returns
void
disableControllers()
disableControllers():
void
Defined in: src/input/Input.ts:516
Returns
void
disableGazeController()
disableGazeController():
void
Defined in: src/input/Input.ts:511
Returns
void
dispatchEvent()
dispatchEvent(
event):void
Defined in: src/input/Input.ts:313
Parameters
event
ControllerEvent
Returns
void
enableControllers()
enableControllers():
void
Defined in: src/input/Input.ts:527
Returns
void
enableGazeController()
enableGazeController():
void
Defined in: src/input/Input.ts:506
Returns
void
enablePivots()
enablePivots():
void
Defined in: src/input/Input.ts:191
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:170
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:67
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:417
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:389
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:405
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:532
Parameters
controller
Controller
Returns
void
setRaycasterFromController()
setRaycasterFromController(
controller):void
Defined in: src/input/Input.ts:457
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:375
Parameters
event
(event) => void
Returns
void
unbindKeyUp()
unbindKeyUp(
event):void
Defined in: src/input/Input.ts:379
Parameters
event
(event) => void
Returns
void
unbindListener()
unbindListener(
listenerName,listener):void
Defined in: src/input/Input.ts:297
Parameters
listenerName
keyof ControllerEventMap
listener
(event) => void
Returns
void
update()
update():
void
Defined in: src/input/Input.ts:431
Returns
void
updateController()
updateController(
controller):void
Defined in: src/input/Input.ts:439
Parameters
controller
Controller
Returns
void
updateReticleFromIntersections()
updateReticleFromIntersections(
controller):void
Defined in: src/input/Input.ts:466
Parameters
controller
Controller
Returns
void