From 4ccee1bf893d9341880815bcb965a7ffadb992e4 Mon Sep 17 00:00:00 2001 From: Nova Date: Wed, 13 Aug 2025 11:57:51 -0700 Subject: [PATCH] fix(lines): properly break line points with same position --- src/nodes/drawable/lines.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/nodes/drawable/lines.rs b/src/nodes/drawable/lines.rs index 1bff47d..26454a1 100644 --- a/src/nodes/drawable/lines.rs +++ b/src/nodes/drawable/lines.rs @@ -77,6 +77,14 @@ fn build_line_mesh( let mut last = line.cyclic.then(|| line.points.last()).flatten(); let mut peekable = line.points.iter().peekable(); while let Some(curr) = peekable.next() { + // Skip this point if it has the same position as the previous point + if let Some(prev) = last { + if Vec3::from(prev.point) == Vec3::from(curr.point) { + last = Some(curr); + continue; + } + } + let mut end = false; // Determine the next point - either the next in sequence or // for cyclic lines, wrap back to first point at the end @@ -93,6 +101,10 @@ fn build_line_mesh( } out }; + // if we can't make a full line, don't bother trying + if point_windows.len() < 2 { + continue; + } for (last, curr, next, last_point) in point_windows { let last_quat = last.map(|v| { Quat::from_rotation_arc(