Builtin Library
README.md
IKLimb
Drives a two-bone limb — an arm or a leg — so its tip lands on a target. Exact and single-pass: the law of cosines answers outright, so there is nothing to converge.
hero.component.add("IKLimb", { role = "rightarm", target = doorknobRef, pole = elbowHintRef })
Fields
role—leftarm,rightarm,leftleg, orrightleg, resolved through the body's canonical role map so one setup works on any humanoid mesh. The vocabulary is not the anatomical word: an upper arm isleftarmand the forearm isleftforearm, while an upper leg isleftuplegand the shin isleftleg.rootBone,tipBone— explicit bones instead, for a rig with no role map. Only the ends are named; the joint between comes from the rig's parent links.target— anEntityRef.pole— anEntityRefsteering which way the joint bends. Put one behind the elbow or in front of the knee. Without a pole the bend plane the incoming animation produced is preserved, which is stable but not always the plane you want.weight— blends against the incoming animation; 0 is an exact pass-through.
Checking it
hero.component.get("IKLimb"):limbState()
-- { ready, status, boneCount, reach, distanceToTarget, hasPole, weight, error }
A limb reaches as far as its bones are long. A target beyond that has no
solution — the arm extends straight toward it and stops, which looks exactly
like a broken solver. ik.reach answers whether a target is inside the band.