Grab buffer (squeeze early, catch on contact), elbow can't fold inward when the controller turns out

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
FoxyzandClaude Opus 5.5 committed 2026-10-02 21:31:14 +03:00
1 parent ca60df3d75
commit b8365ee95f
4 files changed
+48 -5

No files matched your search

+6 -2
View File
@@ -11,7 +11,8 @@ public sealed class ArmSolver
public const float SoftIKFactor = 0.98f;
public const float PoleHandWeight = 0.85f;
public const float PoleSmoothRate = 12f;
public const float PoleMaxAngle = 1.92f; // 110 deg either way from down/back/out
public const float PoleMaxAngle = 1.92f; // 110 deg outward from down/back/out
public const float PoleMaxInward = 0.6f; // 35 deg inward: a controller turned outward must not fold the elbows toward each other (owner)
public const float PoleMaxSpeed = 6f; // rad/s
public const float ElbowRiseAllowance = 0.05f;
@@ -76,7 +77,10 @@ public sealed class ArmSolver
targetAngle = raw * PoleHandWeight * confidence;
}
}
targetAngle = Mathf.Clamp(targetAngle, -PoleMaxAngle, PoleMaxAngle);
// Asymmetric: the elbow may swing far out, but only a little in toward the body's midline.
float outward = refB.Dot(side); // > 0: a positive angle swings the elbow outward
float inwardLimit = Mathf.Lerp(PoleMaxAngle, PoleMaxInward, Mathf.Clamp(Mathf.Abs(outward) / 0.5f, 0f, 1f));
targetAngle = outward >= 0f ? Mathf.Clamp(targetAngle, -inwardLimit, PoleMaxAngle) : Mathf.Clamp(targetAngle, -PoleMaxAngle, inwardLimit);
float step = (targetAngle - _poleAngle) * (1f - Mathf.Exp(-delta * PoleSmoothRate));
_poleAngle += Mathf.Clamp(step, -PoleMaxSpeed * delta, PoleMaxSpeed * delta);
Vector3 pole = refN.Rotated(dir, _poleAngle);