From c8a1f0585c2e70eaaddb33a2711b9e6a9b9c5867 Mon Sep 17 00:00:00 2001 From: Annonnymmousss Date: Thu, 22 Jan 2026 00:49:04 +0530 Subject: [PATCH] feat : Angle between node use consistent direction --- node-graph/nodes/math/src/lib.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/node-graph/nodes/math/src/lib.rs b/node-graph/nodes/math/src/lib.rs index f826f123ed..6b5a9ef5cc 100644 --- a/node-graph/nodes/math/src/lib.rs +++ b/node-graph/nodes/math/src/lib.rs @@ -823,11 +823,10 @@ fn dot_product( /// Calculates the angle swept between two vectors. /// -/// The value is always positive and ranges from 0° (both vectors point the same direction) to 180° (both vectors point opposite directions). +/// The value ranges from -180° to +180° (or -π to +π radians). Positive values indicate an anticlockwise rotation from A to B, while negative values indicate a clockwise rotation. #[node_macro::node(category("Math: Vector"))] fn angle_between(_: impl Ctx, vector_a: DVec2, vector_b: DVec2, radians: bool) -> f64 { - let dot_product = vector_a.normalize_or_zero().dot(vector_b.normalize_or_zero()); - let angle = dot_product.acos(); + let angle = vector_a.angle_to(vector_b); if radians { angle } else { angle.to_degrees() } }