From 24a9b208bda8cdcb823338db9dc2ed6b4eeabdf2 Mon Sep 17 00:00:00 2001 From: yuni Date: Sat, 8 Jun 2024 04:13:26 +0200 Subject: [PATCH] fix direction of orbital velocity --- src/nature.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nature.rs b/src/nature.rs index 17b8ae2..7071fc9 100644 --- a/src/nature.rs +++ b/src/nature.rs @@ -176,7 +176,7 @@ pub fn orbital_velocity(coords: DVec3, mass: f64) -> DVec3 { let speed = (G * mass / r).sqrt(); // This generates a perpendicular orbital vector in the prograde direction - let perpendicular = DVec3::new(-coords.z, 0.0, -coords.x).normalize(); + let perpendicular = DVec3::new(coords.z, 0.0, -coords.x).normalize(); return perpendicular * speed; }