dragging! and some other things, also bevy 0.8 now(which is annoying me currently due to a weird bug in exit
This commit is contained in:
parent
509a11a6a9
commit
1da4c5b473
9 changed files with 509 additions and 478 deletions
|
@ -7,7 +7,7 @@ pub fn get_mouse_pos(q_cam: &Query<(&Camera, &GlobalTransform), With<MainCamera>
|
|||
if let Some(screen_pos) = wnd.cursor_position() {
|
||||
let w_size = Vec2::new(wnd.width() as f32, wnd.height() as f32);
|
||||
let ndc = (screen_pos / w_size) * 2.0 - Vec2::ONE;
|
||||
let ndc_to_world = cam_pos.compute_matrix() * cam.projection_matrix.inverse();
|
||||
let ndc_to_world = cam_pos.compute_matrix() * cam.projection_matrix().inverse();
|
||||
let world_pos = ndc_to_world.project_point3(ndc.extend(-1.0));
|
||||
let world_pos: Vec2 = world_pos.truncate();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue