Is the primary pointer double clicked (usually the left button). This is equivalent to input.mouseDoubleClick
Was a double click detected for the primary pointer?
Is the primary pointer clicked (usually the left button). This is equivalent to input.click
Was a double click detected for the primary pointer? This is equivalent to input.doubleClick
Adds an event listener for the specified event type. The callback will be called when the event is triggered.
The event type to listen for
The callback to call when the event is triggered
Optional
options: EventListenerOptionsThe options for adding the event listener.
input.addEventListener("pointerdown", (evt) => {
console.log("Pointer down", evt.pointerId, evt.pointerType);
});
By using a higher value for the queue the listener will be called after other listeners (default queue is 0).
input.addEventListener("pointerdown", (evt) => {
console.log("Pointer down", evt.pointerId, evt.pointerType);
}, { queue: 10 });
Adds an event listener for the specified event type. The callback will be called when the event is triggered.
The event type to listen for
The callback to call when the event is triggered
Optional
options: EventListenerOptionsThe options for adding the event listener.
input.addEventListener("pointerdown", (evt) => {
console.log("Pointer down", evt.pointerId, evt.pointerType);
});
By using a higher value for the queue the listener will be called after other listeners (default queue is 0).
input.addEventListener("pointerdown", (evt) => {
console.log("Pointer down", evt.pointerId, evt.pointerType);
}, { queue: 10 });
Optional
pointerType: string | string[] | PointerType[]the first button that was down and is currently pressed
Get a connected Gamepad
Note: For a gamepad to be available to the browser it must have received input before while the page was focused.
The gamepad or null if no gamepad is connected
Check if a pointer id is currently used.
the last (most recent) button that was down and is currently pressed
Gets the position of the given pointer index in pixel
The pointer index
The position of the pointer in pixel
The pointer position in screenspace coordinates (-1 to 1) where 0 is the center of the screen.
This can be useful for e.g. raycasting (see https://threejs.org/docs/#api/en/core/Raycaster.setFromCamera)
how many pointers are currently pressed
Removes the event listener from the specified event type. If no queue is specified the listener will be removed from all queues.
The event type to remove the listener from
The callback to remove
Optional
options: EventListenerOptionsThe options for removing the event listener
Removes the event listener from the specified event type. If no queue is specified the listener will be removed from all queues.
The event type to remove the listener from
The callback to remove
Optional
options: EventListenerOptionsThe options for removing the event listener
Set a custom cursor. This will set the cursor type until unsetCursor is called
Unset a custom cursor. This will set the cursor type to the previous type or default
The input system is responsible for handling all input events like pointer events (mouse, touch, xr controllers) and keyboard events.