From 70922ba0a70111d34ed01dc9b324c5ebb57df515 Mon Sep 17 00:00:00 2001 From: johnny-smitherson <127537716+johnny-smitherson@users.noreply.github.com> Date: Fri, 3 Nov 2023 21:30:03 +0000 Subject: flip y coord in 3d highlight_hovered_body --- src_testbed/testbed.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src_testbed') diff --git a/src_testbed/testbed.rs b/src_testbed/testbed.rs index 2c83d1f..7bd40bb 100644 --- a/src_testbed/testbed.rs +++ b/src_testbed/testbed.rs @@ -1501,7 +1501,7 @@ fn highlight_hovered_body( } if let Some(cursor) = window.cursor_position() { - let ndc_cursor = (cursor / Vec2::new(window.width(), window.height()) * 2.0) - Vec2::ONE; + let ndc_cursor = Vec2::new(cursor.x / window.width() * 2.0 - 1.0, 1.0 - cursor.y / window.height() * 2.0); let ndc_to_world = camera_transform.compute_matrix() * camera.projection_matrix().inverse(); let ray_pt1 = ndc_to_world.project_point3(Vec3::new(ndc_cursor.x, ndc_cursor.y, -1.0)); let ray_pt2 = ndc_to_world.project_point3(Vec3::new(ndc_cursor.x, ndc_cursor.y, 1.0)); -- cgit