cut11b: compute direct bounded joint error in StepDof without +-pi wrapback

This commit is contained in:
Meta Vens 2026-12-06 03:10:08 +01:00
commit 1bbf0c9eee

View file

@ -2112,7 +2112,7 @@ namespace RustToDust.Ymir
float recoilTorque, float recoilTorque,
float dt) float dt)
{ {
float err = MatchRules.NormalizeAngle(target - theta); float err = target - theta;
float tau = Math.Clamp(kp * err - kd * omega, -tauMax, tauMax) + recoilTorque; float tau = Math.Clamp(kp * err - kd * omega, -tauMax, tauMax) + recoilTorque;
omega += (tau / inertia) * dt; omega += (tau / inertia) * dt;
theta = Math.Clamp(theta + omega * dt, -3.08f, 3.08f); theta = Math.Clamp(theta + omega * dt, -3.08f, 3.08f);