Hacker News new | past | comments | ask | show | jobs | submit login

If only there were an API for mouse capturing.

Is there any reason why it couldn't work if it were implemented like full screen mode (displaying a message telling the user to press escape to reclaim the mouse)?

Edit: Actually it looks like this is being worked on after all – http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.htm...




This exists in Firefox as of 14, currently in Aurora, so this will be in a stable release in a few weeks.

It also exists in recent Chrome versions, however it seems to be disabled by default for some reason, but you can enable it in the flags menu.

No reason why this cool site can't use it on those browsers, there are lots of demos on the web that do. Mouse lock is very important.


> This exists in Firefox as of 14, currently in Aurora, so this will be in a stable release in a few weeks.

Firefox 14 is scheduled for release on Tuesday.[1]

[1] https://wiki.mozilla.org/RapidRelease/Calendar#Future_branch...


Even better ;) Thanks for the correction!


No problem. I looked it up last week because I thought this was the release that was going to have the new fix for add-on-related memory leaks[1], but it turns out that's not coming until Firefox 15 next month.

[1] http://news.softpedia.com/news/Firefox-15-to-Fix-All-Common-...


> It also exists in recent Chrome versions, however it seems to be disabled by default for some reason

It's enabled at least for the Chrome Store/NaCl apps, since it did that to me for Bastion and/or From Dust.


The reason would be security-related, as usual. I take it you deal with the clickjacking potential, and the potential for deliberate annoyances?


Fullscreen also has security issues, more in fact, I believe? And it is not behind a flag. Also, mouse lock is enabled in Chrome in NaCl apps, but not HTML5 ones. So I am not clear on what's going on there.


Yeah, it does exist and is usable in current versions of Chrome if you change the flag for it. I'm not sure if the Chrome version of the API is what the final one will be though, since it seems to differ somewhat from the version documented on MDN: https://developer.mozilla.org/en/API/Pointer_Lock_API

Still it would probably be fairly easy to add support for it to this and replace the annoying click-drag camera movement when possible.


I just implemented that in a fork: https://github.com/danielribeiro/WebGLCraft/

Only works in Chrome for now, if you enable it in chrome://flags. You don't even need to be in full-screen mode, at least on the latest version.

Pull request is here: https://github.com/danielribeiro/WebGLCraft/pull/1


Oops. That first link should be https://github.com/ricardobeat/WebGLCraft/

Page at http://ricardobeat.github.com/WebGLCraft/, press C to enable mouse lock. Aiming doesn't work very well...


Seriously, what the hell is the point of even creating something like webgl if a key feature for immersion is kept out?

It's like building a car starting with the frame.

God speed to whoever is fighting the good fight on those frigging w3c boards.


As mentioned above, this feature does in fact exist.


Ah, wrote before the edit.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: