Pointer Lock API?

0 favourites
  • 8 posts
From the Asset Store
Integrate Telegram Payments API into your Construct 3 projects for seamless in-app payment processing.
  • It's new API is designed for HTML5 games to lock mouse pointer while is playing.

    Is designed for 3D games, but 2D games too like RTS and something which use for infinite scroll.

    https://developer.mozilla.org/es/docs/API/Pointer_Lock_API

    Is possible to implement this API for C2?

  • It's not necessary for RTS games, you can do infinite scroll just by detecting the mouse at the edge of the window. I'm not sure it's useful outside of 3D games, so I hadn't planned to support it.

  • There's also a problem with Pointer Lock API that isn't addressed for the moment : the pointer acceleration. Since the workgroup decided that they don't take it into account, I can imagine a lot of games were it's going to do some strange behaviors, since the mouse pointer is going to have a non-linear acceleration.

  • I'm kind of disappointed in what the API turned to be.

    I'm still waiting for a mouse pointer lock that would allow you to limit your mouse cursor to the canvas and even allow you to set the position of the cursor where/when you want.

    I don't really see the need for the API discussed with what it's proposing.

    Has anyone any practical example of use to make me change my mind ?

  • It's not necessary for RTS games, you can do infinite scroll just by detecting the mouse at the edge of the window. I'm not sure it's useful outside of 3D games, so I hadn't planned to support it.

    Ashley Ah ok, then it's optional for future version, it would be nice to make new kind of game mechanics like rotating, zoom canvas without leaving the pointer outside of window.

    There a 2D example:

    http://www.smartjava.org/examples/pointerlock/

    click window on right and say Ok to pointer lock permission, you can move your mouse to anywhere to make it infinite scroll, otherwise the left window is limited due to pointer position.

    Kyatric there a example above, some nice information about Pointer Lock API

    http://www.html5rocks.com/en/tutorials/pointerlock/intro/

  • The 2D example does not work in Firefox at the moment, that's sad.

    The quake viewer in the html5rocks article does work in FF though.

    And it indeed locks the mouse's cursor out of the boundaries in full screen which is what I'd want

    Not in "not-fullscreen" though. (EDIT: after test, it's only in FF for now that the cursor is not locked in "not-fullscreen")

    It could be indeed an interesting behavior or addition to the mouse plugin once the API is a bit more stabilized and Ashley has more time on his hands.

    EDIT: With parallax I can see some 2D FPS and TPS that would still be nice looking and interesting to play.

    You'd mostly move in a lateral way, hardly in depth even though it would be theoretically possible (cf CubeMaze by ).

    Thanks Joannesalfa

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Now that C2 has 3D support from Mode7, can we get this in so it's possible to use the mouse in a 3D game.

  • I guess Ashley ignored this feature, i guess some Javascript SDK developer would create this plugin if he wants

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)