Hello, everyone. I triggered the pointerlockcontrols control by click the event, and everything started to work well. But when I press the ESC key to exit and click to trigger pointerlockcontrols again, pointerlockcontrols will throw a pointerlockerror exception. After consulting the relevant API, I can’t find any reason. Have you ever had a similar situation?
You can view it directly through the official website link console.
Works for me without issues. What OS and browser are you using?
windows and Google Chrome 85.0.4183.83 version.There is no problem in entering for the first time. When I exit ESC and click again, there will be an exception. I don’t know if it is the reason after the browser is upgraded!
It should be a browser problem. I just tested Google Chrome 84.0.4147.135 in normal.
getting this error too on Chrome 85.0.4183.83, seems like there is some sort of debounce on enabling the pointer lock controls.
Chrome 84 version has this problem. It seems that there will be deviation in obtaining lock elements after full screen.
I have Chrome 85.0.4183.83 and indeed, sites that worked fine before now take a random amount of requests (which raise the error “THREE.PointerLockControls: Unable to use Pointer Lock API”) to trigger the pointerlock again after having exited it once.
Can be reproduced with the official example: three.js - pointerlock controls
Still works perfectly with other browsers so definately a newer Chrome revision specific bug
There is now a Chromium bug for this issue:
Please star the bug report in order to raise its priority.
Just to give an update for anyone viewing this in 2021 onwards, the above Chromium bug was merged into an existing one. There was apparently an intentional 2 second timeout implemented between pointer locks to prevent abuse, and they ended up compromising by lowering it to 1.25 seconds instead. That’s where I believe it still is today.