bevyengine / bevyengine/bevy

Broken touch processing on iPhone 13-12 mini, (simulator, real device, no matter)

Open
#10,175 1 comment 0 reactions 0 assignees View on GitHub
A-Input C-Bug O-iOS
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version

0.11.3

## \[Optional\] Relevant system information

Happens only on the iPhone 13 mini or 12 mini.

## What you did

Seems like on these devices TouchInput is incorrectly processed.

Example code

```Rust
use bevy::{
log::{Level, LogPlugin},
prelude::*,
window::WindowMode, gizmos::GizmoPlugin,
};

#[derive(Resource, Deref, DerefMut)]
struct CirclePos(Vec2);

#[bevy_main]
fn main() {
App::new()
.insert_resource(AmbientLight {
color: Color::BLACK,
brightness: 0.04,
})
.add_plugins(
DefaultPlugins
.set(WindowPlugin {
primary_window: Some(Window {
resizable: false,
mode: WindowMode::BorderlessFullscreen,
..default()
}),
..default()
})
.set(GizmoPlugin)
.set(LogPlugin {
level: Level::INFO,
filter: "info,wgpu_core=warn,wgpu_hal=warn,winit=error".into(),
}),
)
.add_systems(Startup, on_create)
.add_systems(Update, input)
.run();
}

fn on_create(mut commands: Commands, window: Query<&Window>, mut config: ResMut) {
commands.spawn(Camera2dBundle::default());
let window = window.single();

commands.spawn(SpriteBundle {
sprite: Sprite {
color: Color::BLACK,
custom_size: Some(Vec2 {
x: window.width(),
y: window.height(),
}),
..default()
},
..default()
});

commands.insert_resource(CirclePos(Vec2::ZERO));
config.line_width = 10.;
}

fn input(
mut gizmos: Gizmos,
mut input: EventReader,
mut circle_pos: ResMut,
window: Query<&Window>,
camera: Query<(&Camera, &GlobalTransform)>,
) {
let window = window.single();
let (camera, transform) = camera.single();

for ev in input.into_iter() {
info!("Window height => {}", window.height());
info!("Window width => {}", window.width());
info!("Touch Position => {}", ev.position);
**circle_pos = camera.viewport_to_world_2d(transform, ev.position).unwrap();
}

gizmos.circle_2d(**circle_pos, 30., Color::RED);
}

```

## What went wrong

On iPhone 12 mini touch incorrectly processed to the world. Also, it's impossible to reach the end of the screen.

## Additional information

https://github.com/bevyengine/bevy/assets/3709476/2d0167cb-1689-4879-875b-61c013ad107b

https://github.com/bevyengine/bevy/assets/3709476/7ff78e92-7bbf-44c9-8680-afc038eab31b

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.