public void Control(float thrust, float torque, bool firing) { Firing = firing; thrust = Fmath.Clamp(thrust, 0.0f, 1.0f); if (torque == 0) { // This is negative feedback, so im unsure why torque and angular velocity have different signs. torque = AngularVelocity * 10f; } torque = Fmath.Clamp(torque, -1.0f, 1.0f); /* * float epsilon = 0.001f; * if (torque < epsilon && torque > -epsilon) * { * float dt = (CollisionBody.AngularVelocity > epsilon) ? 1f : ((CollisionBody.AngularVelocity < -epsilon) ? -1f : 0f); * torque = dt; * } */ CollisionBody.AddForce(Fmath.CosSin(Angle, Thrust * thrust)); CollisionBody.AddTorque(Torque * torque); }