Mouse warping with HTML5 pointer lock API?

Hello all, I’ve been working on a 3D first person game using OpenFL, and I’ve been wondering if it’s possible to lock the mouse to the center and hide it in the HTML5 target, to simulate mouselook. I’ve managed to do this in the native targets by using Mouse.hide and Mouse.warp, but the Mouse.warp function is apparently empty in the HTML5 Lime backend.

Is it possible to somehow use the canvas Pointer lock API in conjuction with Mouse.warp to simulate this? I’ve tried doing


but to no avail.

Wait, nevermind, sorry. I forgot that calls to requestPointerLock() should be made inside event listener callbacks (eg. on mouse click, etc.)

Would it be possible to add this into Lime so that HTML5 behaves like the other targets under one API? :slight_smile:

I’m not so sure. From my understanding, Mouse.warp() moves the pointer to a certain location in the screen. This is not allowed in the browser, however, and the pointer lock API is only capable of centering the mouse on the screen to simulate first person movement.