I'm trying to do this without casting any rays or anything, just by calculating a multiplier for the mouse delta and I'm stuck 😵💫
Smart math ppl please help 😭
my current code for moving the camera:
fn move_camera(mut evr_motion: EventReader<CursorMoved>, mut cameras: Query<&mut Transform, With<Camera3d>>, primary_window: Query<&Window, With<bevy::window::PrimaryWindow>>) {
for mut camera in &mut cameras {
let (_, camera_angle) = camera.rotation.to_axis_angle();
let camera_angle = camera_angle / std::f32::consts::PI;
for ev in evr_motion.read() {
if let Some(delta) = ev.delta {
let camera_move_multiplier = (ev.position.y / (primary_window.get(ev.window).unwrap().height() * camera_angle.fract()) + 1_f32) / 16_f32;
camera.translation.x -= delta.x * camera_move_multiplier;
camera.translation.z -= delta.y * camera_move_multiplier;
}
}
}
}