simplified
This commit is contained in:
@@ -56,23 +56,15 @@ fn update_trail(
|
|||||||
gizmo.clear();
|
gizmo.clear();
|
||||||
|
|
||||||
let lerp_denom = trail.points.len() as f32;
|
let lerp_denom = trail.points.len() as f32;
|
||||||
for (i, window) in trail.points.windows(2).enumerate() {
|
|
||||||
let [a, b] = window else {
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
let a = GlobalTransform::from_translation(*a)
|
|
||||||
.reparented_to(parent_transform)
|
|
||||||
.translation;
|
|
||||||
let b = GlobalTransform::from_translation(*b)
|
|
||||||
.reparented_to(parent_transform)
|
|
||||||
.translation;
|
|
||||||
|
|
||||||
gizmo.line(
|
gizmo.linestrip_gradient(trail.points.iter().enumerate().map(|(i, pos)| {
|
||||||
a,
|
(
|
||||||
b,
|
GlobalTransform::from_translation(*pos)
|
||||||
|
.reparented_to(parent_transform)
|
||||||
|
.translation,
|
||||||
trail.col_start.mix(&trail.col_end, i as f32 / lerp_denom),
|
trail.col_start.mix(&trail.col_end, i as f32 / lerp_denom),
|
||||||
);
|
)
|
||||||
}
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user