@@ 118,7 118,14 @@ fn player_thrust(
let forward = (transform.rotation * Vec3::Y).xy();
let mut external_force = ExternalForce::default();
- let mut thrusters = [0.0; 4]; // counterclockwise wrt +y axis
+
+ // indices are quadrants:
+ // 1 | 0
+ // --+--
+ // 2 | 3
+ //
+ let mut thrusters = [0.0; 4];
+
if thrust.up {
thrusters[1] = 1.0;
thrusters[2] = 1.0;
@@ 135,6 142,11 @@ fn player_thrust(
thrusters[1] = 1.0;
thrusters[3] = 1.0;
}
+
+ // prevent fuel wasting when turning while moving forward/reverse
+ if thrusters[2] == thrusters[3] && thrusters[3] != 0.0 { (thrusters[2], thrusters[3]) = (0.0, 0.0); }
+ if thrusters[0] == thrusters[1] && thrusters[1] != 0.0 { (thrusters[0], thrusters[1]) = (0.0, 0.0); }
+
let half_size = Vec2::new(
world_config.part.default_width / 2.0,
world_config.part.default_height / 2.0,