Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rcore_web] Relative mouse mode issues #3916

Open
cemalgnlts opened this issue Apr 12, 2024 · 1 comment · May be fixed by #3940
Open

[rcore_web] Relative mouse mode issues #3916

cemalgnlts opened this issue Apr 12, 2024 · 1 comment · May be fixed by #3940
Labels
platform: Web Web platform

Comments

@cemalgnlts
Copy link

cemalgnlts commented Apr 12, 2024

Issue description

Hi,
When DisableCursor() is used, the mouse does not enter relative mode and the position is accumulated as the screen is rotated. This is why the mouse ray never gives the correct information.

Environment

Web - WASM - Emscripten

Issue Screenshot

When I rotate the screen one turn in the video, the position is doubled and the track from the mouse is not visible, I have to rotate the screen back one turn.
Screen recording 2024-04-11 21.36.17.webm

Code Example

https://www.raylib.com/examples.html
raylib [models] example - Mesh picking in 3d mode, ground plane, triangle, mesh

Suggestions & Ideas

If I look at the pull request here (#3874), this is the method used: glfwSetInputMode(platform.handle, GLFW_RAW_MOUSE_MOTION, GLFW_FALSE);
But emscripten does not support this: https://github.com/emscripten-core/emscripten/blob/46bd566937e1559a6b732cc78666e5be08cc414d/src/library_glfw.js#L974

However, when the pointer is locked, the browser always gives you the position where it is locked. Therefore, if the pointer is locked (DisableCursor is used), the middle position of the screen can be given instead of the mouse position on the screen.

@raysan5 raysan5 added the platform: Web Web platform label Apr 21, 2024
@raysan5 raysan5 changed the title [rcore_web] Relative Mouse Mode [rcore_web] Relative mouse mode issues Apr 21, 2024
@raysan5
Copy link
Owner

raysan5 commented Apr 21, 2024

@cemalgnlts Thanks for reporting!

However, when the pointer is locked, the browser always gives you the position where it is locked. Therefore, if the pointer is locked (DisableCursor is used), the middle position of the screen can be given instead of the mouse position on the screen.

I'm afraid I'm not understanding the proposed solution, could you send a PR for review?

@cemalgnlts cemalgnlts linked a pull request Apr 27, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Web Web platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants