fix direction of orbital velocity

This commit is contained in:
yuni 2024-06-08 04:13:26 +02:00
parent 1614ece72a
commit 24a9b208bd

View file

@ -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;
}