eozan Posted July 4, 2014 Share Posted July 4, 2014 Hi, The game I'm working on requires pointer lock, and I try to request pointer lock, with no success, because it needs to be triggered on some event. (Because of browser security stuff, understandably). - Is there any way to get pointer lock outside of an event, automatically? So, the easiest solution is to add a button or text and request pointer lock in click event of the item. But, I don't want to do it, if there is another way. I thought about adding it to the click event of world or stage, but didn't work. Maybe there is some object representing "any/all objects", which would make things easier, so that I can request pointer lock on the next event after lock is released. - What is the best practice for this? How can I request pointer lock so that it's easiest for me, but also as little "hacky" as possible? Link to comment Share on other sites More sharing options...
CtlAltDel Posted July 4, 2014 Share Posted July 4, 2014 I use it like this, which works fine. the 'this' context is my state object, and the onDown is added in the create()this.game.input.onDown.add(this.requestPointerLock, this);...requestPointerLock: function() { this.game.input.mouse.requestPointerLock();}, Link to comment Share on other sites More sharing options...
Recommended Posts