Suggestion: Pointer Locking in Mouse Object

Discussion and feedback on Construct 2

Post » Mon Mar 10, 2014 8:48 am

In case it hasn't already been mentioned, just thought I'd draw attention to the fact that both Chrome and Firefox now seem to be supporting pointer locking. If this feature becomes part of the native Mouse object in C2, it would allow C2 users to develop a new class of HTML-5 mouse-controlled games that can use "raw" mouse movement data for controls rather than edge-restricted absolute coordinates. Pretty cutting edge stuff ;)
Image
B
10
S
3
G
2
Posts: 196
Reputation: 2,053

Post » Mon Mar 10, 2014 4:56 pm

I like the sound of that but get the impression it only works in full screen. Could easily be wrong though.
Last edited by spongehammer on Fri Mar 28, 2014 8:35 am, edited 1 time in total.
B
49
S
16
G
9
Posts: 1,098
Reputation: 11,222

Post » Mon Mar 10, 2014 10:51 pm

In Chrome, this example works without full screen. The page also suggests that "Originally pointer lock was tied to the FullScreen API. Meaning that an element must be in fullscreen mode before it can have the pointer locked to it. That is no longer true and pointer lock can be used for any element in your application full-screen or not."

Also, just to further reiterate the advantages of pointer lock for HTML-5 games, let me quote the example in the first paragraph of the article, which I think sums it up quite well, although note that with pointer locking the advantages go beyond that of simply implementing first-person shooter controls:

The Pointer Lock API helps properly implement first-person shooter controls in a browser game. Without relative mouse movement the player's cursor could, for example, hit the right edge of the screen and any further movements to the right would be discounted - the view would not continue to pan right, and the player would not be able to pursue the bad guys and strafe them with his machine gun. The player is going to get fragged and become frustrated. With pointer lock this suboptimal behaviour can't happen.
Image
B
10
S
3
G
2
Posts: 196
Reputation: 2,053


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 16 guests