Skip to content

Commit

Permalink
Fix preferring image depth over object depth when showing depth from …
Browse files Browse the repository at this point in the history
…3D in 2D view (#2009)
  • Loading branch information
Wumpf authored May 2, 2023
1 parent 3212976 commit bb450a9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/re_viewer/src/ui/view_spatial/scene/picking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ pub struct PickingResult {

impl PickingResult {
pub fn space_position(&self) -> Option<glam::Vec3> {
self.hits.last().map(|hit| hit.space_position)
// Use gpu hit if available as they are usually the position one expects.
// (other picking sources might be in here even if hidden!)
self.hits
.iter()
.find(|h| h.hit_type == PickingHitType::GpuPickingResult)
.or_else(|| self.hits.first())
.map(|hit| hit.space_position)
}
}

Expand Down

0 comments on commit bb450a9

Please sign in to comment.