diff --git a/src/testing/TestThruster.cs b/src/testing/TestThruster.cs index 4c0b5cb..e128e6e 100644 --- a/src/testing/TestThruster.cs +++ b/src/testing/TestThruster.cs @@ -25,16 +25,18 @@ public partial class TestThruster : RigidBody3D public override void _Process(double delta) { + float throttleStep = 0.2f * (float)delta; if (Input.IsKeyPressed(Key.Shift)) { - Throttle += 0.1f * (float)delta; + Throttle += throttleStep; } else if (Input.IsKeyPressed(Key.Ctrl)) { - Throttle -= 0.1f * (float)delta; + Throttle -= throttleStep; } - torque = Vector3.Zero; + var torque = Vector3.Zero; + float torqueStep = 0.1f; if (Input.IsKeyPressed(Key.W)) { torque += new Vector3(-1.0f, 0.0f, 0.0f); // Forward (X-) @@ -59,7 +61,8 @@ public partial class TestThruster : RigidBody3D { torque += new Vector3(0.0f, -1.0f, 0.0f); // Down (Y-) } - torque *= 0.01f; + torque *= torqueStep; + this.torque = torque; if (Input.IsKeyPressed(Key.T) && !stabilizeDebounce) { @@ -91,13 +94,13 @@ public partial class TestThruster : RigidBody3D public override void _PhysicsProcess(double delta) { var thrust = Throttle * 100.0f; - var thrustVec = this.Transform * new Vector3(0.0f, thrust, 0f); + var thrustVec = this.Transform.Basis * new Vector3(0.0f, thrust, 0f); this.ApplyCentralForce(thrustVec); Vector3 torque; if (!this.torque.IsZeroApprox()) { - torque = this.torque; + torque = this.Transform.Basis * this.torque; } else if (stabilize) {