i'm trying to do this kind of robotic arm with IK. I have followed this simple FABRIK tutorial and currently figured out as follow (calculating the node positions without any constraint):
for (int j = 0; j < iterationCount; j++) {
// Backward
nodePositions[nodeCount - 1] = targetPos;
for (int i = nodeCount - 2; i >= 0; i--) {
dir = (nodePositions[i] - nodePositions[i + 1]).normalized;
nodePositions[i] = nodePositions[i + 1] + dir * arms[i].Length;
}
// Forward
nodePositions[0] = rootNodePos;
for (int i = 1; i < nodeCount; i++) {
dir = (nodePositions[i] - nodePositions[i - 1]).normalized;
nodePositions[i] = nodePositions[i - 1] + dir * arms[i - 1].Length;
}
}
But how do i implement angular limits on joints? Like arm_0[min-max], arm_1[min-max] . . .
Reference image: https://i.stack.imgur.com/KamBO.png