bevyengine / bevyengine/bevy

Cursor Lock Does Nothing on MacOS

Open
#4,875 6 comments 0 reactions 0 assignees View on GitHub
A-Input A-Windowing C-Bug O-MacOS S-Blocked
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
4d 8m
Merged PRs (30d)
147

Description

## Bevy version

0.7.0

## Relevant system information

MacOS Macbook Pro 13" running on M1 processor

## What you did

```rs
fn lock_mouse(window: &mut Window) {
window.set_cursor_visibility(false);
window.set_cursor_lock_mode(true);

window.set_cursor_position(Vec2::new(window.width() / 2.0, window.height() / 2.0));
}
```

## What went wrong

- what were you expecting?
For this code to do both correctly, like it does on Windows.

- what actually happened?
On MacOS, this hides the cursor while it's in the window, but does not lock the cursor to the window.

## Additional information

This function is being called on a startup system. Doing it after, in a main system, doesn't work either.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.