Make normalize node safer for the user

This commit is contained in:
celyk 2025-07-06 19:40:14 +10:00
parent 592d6bfcbd
commit 7de13aca3e

View file

@ -619,9 +619,11 @@ fn length(_: impl Ctx, vector: DVec2) -> f64 {
}
/// Scales the input vector to unit length while preserving it's direction. This is equivalent to dividing the input vector by it's own magnitude.
///
/// Returns zero when the input vector is zero.
#[node_macro::node(category("Math: Vector"))]
fn normalize(_: impl Ctx, vector: DVec2) -> DVec2 {
vector.normalize()
vector.normalize_or_zero()
}
#[cfg(test)]