Pointer lock provides input methods based on the movement of the mouse over time, not just the absolute position of the mouse cursor.
Questions tagged [pointerlock]
61 questions
1
vote
1 answer
How to initiate Three.js PointerLockControls when camera is not at origin?
I am trying to use PointerLockControls in my three.js game and I want my player to start from another point but not from origin.
Let's say I want to start playing from 1000,0,0. If I place: camera.position.set(1000, 0, 0) in line 193 in…

Dimitrios Ververidis
- 1,118
- 1
- 9
- 33
1
vote
0 answers
Set negative minDistance on Trackball? (or, combining PointerLock and Trackball)
Perhaps that's no the way to approach it, but I'm looking for a sort of a combination of PointerLock and Trackball controls - I want to be able to move the dolly endlessly in and out with scrolling like PointerLock, but be able to drag around and…

Guy Jang
- 11
- 1
1
vote
1 answer
Confirm dialog box while using HTML5 pointer lock API
I am trying out pointer lock API using this demo page. But while running the code I am seeing that browser is showing a confirmation dialog box asking whether user wants to hide the mouse pointer. Is there any way to prevent this dialog box from…

Diptendu
- 2,120
- 1
- 15
- 28
1
vote
1 answer
Sync rendered mouse (WebGL) and Pointer Lock coordinates in WebVR-mode
I am trying to sync my rendered mouse with pointer lock coordinates. The pointer lock hides the mouse cursor, so that's why I need to draw it separately. I have a 3D-scene with a primitive as mouse pointer. I used billboarding to draw the mouse…

Sincostan
- 361
- 2
- 11
1
vote
0 answers
Three.js: PointerLockControls somehow change the position of stencil
I'm using the stencil buffer to composite two THREE.js Scenes over each other. This works, but when I try to use PointerLockControls, moving the camera (using mouse or keyboard) somehow causes the stenciled part of the view to be moved/shifted. It…

vorsk
- 148
- 1
- 7
1
vote
1 answer
How to contain my mouse pointer within a canvas/div?
I am currently trying to make a small html5 canvas game.
I want my mouse pointer to stay within a div element or canvas boundary.
Point me in the right direction please.

Nevin Madhukar K
- 3,031
- 2
- 25
- 52
0
votes
1 answer
How to use third person like controls using PointerLockControls?
I'm trying to create a third-person game like this one using three.js.
The code for the above demo looks like this -
let anchor = new THREE.Object3D()
// anchor = character
anchor.position.y = 10
// Somewhere in the middle, a perspective camera is…

Prav
- 610
- 8
- 20
0
votes
0 answers
Pointer Lock but without message like in Figma when dragging to set width
Edit: Question is resolved. See my first comment.
I'm looking to achieve some pointer lock behaviour like this but without the Press [esc] to show your cursor message, or via some hacky workaround or illusion of doing the same.
Demo:…

wongz
- 3,255
- 2
- 28
- 55
0
votes
1 answer
Cannot read properties of undefined (reading 'getHex’) when trying to combine webgl_interactive_cubes with pointer lock three.js
I’m trying to create scene with walk-navigation, with interactive objects, for educational purpose. I’m using Pointer Lock Control example for a walk navigation and interactive cubes example from three.js. It’s beginning so project is far from being…

guyfromthesun
- 31
- 5
0
votes
0 answers
Prevent mouse pointer events interfering with simulated events
I am trying to simulate mouse events to perform an action in the DOM like making a selection by moving the pointer from point A to pointer B. Here is an example of the event that I am using.
const start = {
clientX: start.left + 1,
clientY:…

Samarth Agarwal
- 2,044
- 8
- 39
- 79
0
votes
0 answers
Pointerlock acting weird with Wacom One tablet
I have a HTML canvas which I want to use with Pointerlock to prevent people using the drawing tablet from clicking on other elements in the page.
When not using Pointerlock there is no real difference between mouse/touchpad/wacom one. But when I use…

Maarten
- 4,643
- 7
- 37
- 51
0
votes
0 answers
Why is checking raycast intersections so slow in Three.js?
I'm making an FPS game using Three.js.
Take a look at this code:
let raycaster = new THREE.Raycaster();
raycastTargets = [otherPlayer];
center = new THREE.Vector2(0,0);
function animate() {
raycastTargets[0] = otherPlayer;
…

ProOfficial
- 101
- 8
0
votes
1 answer
pointerLockElement return null when called immediately after requestPointerLock() function
PointerLockElement returns null when called immediately after requestPointerLock() function
domElement.onclick = () => { // requestPointerLock() needs to be called by user input
domElement.requestPointerLock = domElement.requestPointerLock ||…

typ3k
- 1
- 1
0
votes
0 answers
Object is not following with the camera first person view in three js with PointerLockControl
this is my first three js first-person point of view game, I am having trouble when I turn my camera the gun doesn't follow what I am looking at the rotation of the camera.
here is a link for the live site:…

Ti Wei
- 1
0
votes
1 answer
THREE.js pointerlock controls not moving camera around on mouse movement
I tried to follow the source code at https://threejs.org/examples/misc_controls_pointerlock.html without the divs, but it didn't work. I then tried following the code here https://sbcode.net/threejs/pointerlock-controls/ but it also did not work.
I…

Harushii
- 7
- 1
- 5