Skip to content

Cursor lock no longer locks the cursor in place, only confines it to the window #2645

@neo97dev

Description

@neo97dev

Bevy version

main#b13472d

Operating system & version

X11 on Arch Linux 5.13.7-arch1-1

What you did

window.set_cursor_lock_mode(true);

What you expected to happen

The cursor should be locked in place, allowing cursor movement events to work as normal, but keeping the actual mouse cursor from moving or leaving the window. This is important for first-person and third-person camera movement.

What actually happened

The cursor is confined to the bounds of the window, but not locked in place. For example, when moving a first-person camera controller, you can only move the mouse as far as the window bounds go, preventing you from rotating 360 degrees with the mouse.

Additional information

This issue did not occur in Bevy 0.5, only in the main branch. It looks like winit was bumped from 0.24 to 0.25 since Bevy 0.5, but after downgrading winit manually in my fork, the issue still remained. It does not look like winit has changed this behavior on their end since 0.24, so it must be something in bevy, unless I missed something.

Cursor lock does seem to work correctly in fullscreen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-InputPlayer input via keyboard, mouse, gamepad, and moreA-WindowingPlatform-agnostic interface layer to run your app inC-BugAn unexpected or incorrect behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions