I am trying to make something like as long as the user holds the right-click mouse button on canvas, the pointer stays locked and when the user releases the right click, the pointer gets unlocked. However, I am facing an issue here. Default camera movement stops working after locking the pointer in pointerdown event. It doesn’t work until you release the right click. You can give it a try here. https://playground.babylonjs.com/#4ETCX8#2
canvas.addEventListener('pointerdown', (e) => {
if(e.button == 2){
canvas.requestPointerLock();
}
});
Adding @PolygonalSun the master of inputs 
Hey @BlackThunder4007, so I looked at your PG and when I right-click and hold it doesn’t move so it looks like I am able to repro the behavior on both 5.0 and 4.2. When you engage a pointer lock, the default behavior is that cursor will “lock” onto the given element and move the camera, independent of a button being pressed, which would explain why your camera moves after you release the right-click. As for why it’s not moving during the initial button press/pointerlock, I’m not sure so lemme look into this and see what’s going on.
Just wanted to update you on what’s going on. It turns out that there’s some issue with the logic for a pointer lock so that it’s trying to use the values for the clientX/Y from the PointerEvent, rather than the deltas (movmentX/Y) so I’m currently working on the fix for that.
Thank you so much for taking a look into this.
I have a question. How can I use that change in the stable version 4.2.0 I have?
It is not possible, you need to use preview this change follows along with a huge rewrite of some of the inputs to be able to work with babylon native 