Class: Input
Defined in: src/input/Input.ts:33
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:47
controllerGrips
controllerGrips:
Group<Object3DEventMap>[] =[]
Defined in: src/input/Input.ts:36
controllers
controllers:
Controller[] =[]
Defined in: src/input/Input.ts:35
controllersEnabled
controllersEnabled:
boolean=true
Defined in: src/input/Input.ts:43
gazeController
gazeController:
GazeController
Defined in: src/input/Input.ts:41
hands
hands:
XRHandSpace[] =[]
Defined in: src/input/Input.ts:37
initialized
initialized:
boolean=false
Defined in: src/input/Input.ts:39
intersections
intersections:
never[] =[]
Defined in: src/input/Input.ts:46
intersectionsForController
intersectionsForController:
Map<Controller,Intersection<Object3D<Object3DEventMap>>[]>
Defined in: src/input/Input.ts:45
leftController?
optionalleftController:Controller
Defined in: src/input/Input.ts:48
listeners
listeners:
Map<any,any>
Defined in: src/input/Input.ts:44
mouseController
mouseController:
MouseController
Defined in: src/input/Input.ts:42
options
options:
Options
Defined in: src/input/Input.ts:34
pivotsEnabled
pivotsEnabled:
boolean=false
Defined in: src/input/Input.ts:40
raycaster
raycaster:
Raycaster
Defined in: src/input/Input.ts:38
rightController?
optionalrightController:Controller
Defined in: src/input/Input.ts:49
scene
scene:
Scene
Defined in: src/input/Input.ts:50
Methods
addObject()
addObject(
obj):void
Defined in: src/input/Input.ts:163
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:189
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:352
Parameters
event
(event) => void
Returns
void
bindKeyUp()
bindKeyUp(
event):void
Defined in: src/input/Input.ts:356
Parameters
event
(event) => void
Returns
void
bindListener()
bindListener(
listenerName,listener):void
Defined in: src/input/Input.ts:269
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:327
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:319
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:311
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:348
Parameters
event
(event) => void
Returns
void
bindSqueezeEnd()
bindSqueezeEnd(
event):void
Defined in: src/input/Input.ts:344
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:336
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:232
Parameters
event
ControllerEvent
Returns
void
defaultOnDisconnected()
defaultOnDisconnected(
event):void
Defined in: src/input/Input.ts:247
Parameters
event
ControllerEvent
Returns
void
defaultOnSelectEnd()
defaultOnSelectEnd(
event):void
Defined in: src/input/Input.ts:217
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:206
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:227
Parameters
event
ControllerEvent
Returns
void
defaultOnSqueezeStart()
defaultOnSqueezeStart(
event):void
Defined in: src/input/Input.ts:222
Parameters
event
ControllerEvent
Returns
void
disableControllers()
disableControllers():
void
Defined in: src/input/Input.ts:499
Returns
void
disableGazeController()
disableGazeController():
void
Defined in: src/input/Input.ts:494
Returns
void
dispatchEvent()
dispatchEvent(
event):void
Defined in: src/input/Input.ts:298
Parameters
event
ControllerEvent
Returns
void
enableControllers()
enableControllers():
void
Defined in: src/input/Input.ts:510
Returns
void
enableGazeController()
enableGazeController():
void
Defined in: src/input/Input.ts:489
Returns
void
enablePivots()
enablePivots():
void
Defined in: src/input/Input.ts:176
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:155
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:56
Initializes an instance with XR controllers, grips, hands, raycaster, and default options. Only called by Core.
Parameters
__namedParameters
options
renderer
scene
Returns
void
intersectObject()
intersectObject(
obj):Intersection<Object3D<Object3DEventMap>>[]
Defined in: src/input/Input.ts:402
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:374
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:390
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:515
Parameters
controller
Controller
Returns
void
unbindKeyDown()
unbindKeyDown(
event):void
Defined in: src/input/Input.ts:360
Parameters
event
(event) => void
Returns
void
unbindKeyUp()
unbindKeyUp(
event):void
Defined in: src/input/Input.ts:364
Parameters
event
(event) => void
Returns
void
unbindListener()
unbindListener(
listenerName,listener):void
Defined in: src/input/Input.ts:282
Parameters
listenerName
keyof ControllerEventMap
listener
(event) => void
Returns
void
update()
update():
void
Defined in: src/input/Input.ts:416
Returns
void
updateController()
updateController(
controller):void
Defined in: src/input/Input.ts:424
Parameters
controller
Controller
Returns
void
updateReticleFromIntersections()
updateReticleFromIntersections(
controller):void
Defined in: src/input/Input.ts:449
Parameters
controller
Controller
Returns
void