aboutsummaryrefslogtreecommitdiff
path: root/src_testbed
diff options
context:
space:
mode:
authorjohnny-smitherson <127537716+johnny-smitherson@users.noreply.github.com>2023-11-03 21:30:03 +0000
committerjohnny-smitherson <127537716+johnny-smitherson@users.noreply.github.com>2023-11-03 21:30:03 +0000
commit70922ba0a70111d34ed01dc9b324c5ebb57df515 (patch)
tree4adfb4da62986b864957e61d57f908722509f53c /src_testbed
parent3547d78af7ae2cadc34434bb95a7142ae11d6548 (diff)
downloadrapier-70922ba0a70111d34ed01dc9b324c5ebb57df515.tar.gz
rapier-70922ba0a70111d34ed01dc9b324c5ebb57df515.tar.bz2
rapier-70922ba0a70111d34ed01dc9b324c5ebb57df515.zip
flip y coord in 3d highlight_hovered_body
Diffstat (limited to 'src_testbed')
-rw-r--r--src_testbed/testbed.rs2
1 files changed, 1 insertions, 1 deletions
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));