This commit is contained in:
2026-07-11 00:14:41 +02:00
parent 87dd8e1190
commit c9e463bb9a
15 changed files with 183 additions and 51 deletions
+3 -4
View File
@@ -71,10 +71,9 @@ impl CollisionWorld {
pub fn trace(&self, start: [f32; 3], end: [f32; 3], half: [f32; 3]) -> Option<Hit> {
let mut nearest: Option<Hit> = None;
for b in &self.brushes {
if let Some(h) = trace_brush(b, start, end, half) {
if nearest.as_ref().map_or(true, |n| h.frac < n.frac) {
nearest = Some(h);
}
if let Some(h) = trace_brush(b, start, end, half)
&& nearest.as_ref().is_none_or(|n| h.frac < n.frac) {
nearest = Some(h);
}
}
nearest