Clamp an angle to a specified range.
Normalizes angles to the -π to π range before clamping.
Input angle in radians
Minimum allowed angle
Maximum allowed angle
Clamped angle in radians
// Limit joint rotation to 90 degreesconst maxBend = Math.PI / 2;const clampedAngle = clampAngle(jointAngle, -maxBend, maxBend); Copy
// Limit joint rotation to 90 degreesconst maxBend = Math.PI / 2;const clampedAngle = clampAngle(jointAngle, -maxBend, maxBend);
Clamp an angle to a specified range.
Normalizes angles to the -π to π range before clamping.