Skip to content

Commit

Permalink
flip y coord in 3d highlight_hovered_body
Browse files Browse the repository at this point in the history
  • Loading branch information
johnny-smitherson committed Nov 3, 2023
1 parent 3547d78 commit 70922ba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src_testbed/testbed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 70922ba

Please sign in to comment.