bevyengine / bevyengine/bevy

MouseMotion events are jittery on Apple Silicon

Open
#3,857 3 comments 4 reactions 0 assignees View on GitHub
A-Input C-Bug O-MacOS
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version

0.6

## Operating system & version

macOS Monterey 12.2, Apple M1

## What you did

A very basic scene with very basic FPS camera controller updated at variable (non-fixed) timestep.

## What you expected to happen

Both movement (using keyboard) and camera rotation (using mouse) should be smooth.

## What actually happened

Movement is smooth, but camera rotation is jittery.
Which is especially noticeable if you move and rotate at the same time while looking at the cube.

## Additional information

```toml
[package]
name = "mousejitterexample"
version = "0.1.0"
edition = "2021"

[dependencies]
bevy = "0.6"
bevy_flycam = "0.6"
```

```rust
use bevy::prelude::*;

fn setup(
mut commands: Commands,
mut meshes: ResMut>,
mut materials: ResMut>,
) {
commands.spawn_bundle(PbrBundle {
mesh: meshes.add(Mesh::from(shape::Plane { size: 5.0 })),
material: materials.add(Color::rgb(0.3, 0.5, 0.3).into()),
..Default::default()
});
commands.spawn_bundle(PbrBundle {
mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })),
material: materials.add(Color::rgb(0.8, 0.7, 0.6).into()),
transform: Transform::from_xyz(0.0, 0.5, 0.0),
..Default::default()
});
commands.spawn_bundle(PointLightBundle {
point_light: PointLight {
intensity: 1500.0,
..Default::default()
},
transform: Transform::from_xyz(4.0, 8.0, 4.0),
..Default::default()
});
}

#[bevy_main]
fn main() {
App::new()
.insert_resource(Msaa { samples: 4 })
.insert_resource(WindowDescriptor {
title: "mouse jitter example".to_string(),
vsync: false,
width: 1024.,
height: 768.,
..Default::default()
})
.add_plugins(DefaultPlugins)
.add_plugin(bevy_flycam::PlayerPlugin)
.add_startup_system(setup)
.run();
}
```

```
cargo run --release
```

Here is the code processing MouseMotion events (bevy_flycam):
https://github.com/sburris0/bevy_flycam/blob/master/src/lib.rs#L103

I tried replicating a similar without using this crate and got the same problem.
In my opinion this winit issue can be relevant: https://github.com/rust-windowing/winit/issues/1418

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.