From dea8a0dc1aa561a5a9faface46e33e832a000aaf Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Sat, 9 Aug 2025 16:25:19 -0500 Subject: [PATCH] Fix: apply thrust input properly Yay for funny coordinate spaces. I was, again, using the wrong operations to get the 2D Cartesian angle and apply force to the ship. --- src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7b0335b..82e590a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -249,13 +249,12 @@ fn input_ship_thruster( panic!("There should be exactly one player ship! Instead, there seems to be {count}."); }; - let rotation = transform.rotation; let thrusters = children .first() .expect("Couldn't find first child, which should be the thruster"); if keyboard_input.pressed(KeyCode::KeyW) { - velocity.0 += Vec2::from_angle(rotation.z) * SHIP_THRUST; + velocity.0 += (transform.rotation * Vec3::X).xy() * SHIP_THRUST; commands .entity(*thrusters) .insert(MeshMaterial2d(game_assets.thruster_mat_active()));