Builtin Library
README.md
IKAim
Turns a bone chain until a named axis on its tip points at a target. Where
IKLimb drives a tip to a position, this drives it to an orientation — it is
what aims a weapon barrel, a turret, a sensor, or a spotlight.
turret.component.add("IKAim", { rootBone = "base", tipBone = "barrel", target = enemyRef, axisZ = 1 })
Fields
roleorrootBone+tipBone— which chain turns.target— anEntityRef.axisX/axisY/axisZ— the tip's local aiming direction, default+Z. A barrel modelled down+YsetsaxisY = 1andaxisZ = 0.weight— blends against the incoming animation; 0 is an exact pass-through.iterations— aiming is iterative because turning a bone also moves the tip, which changes the direction to the target.
Checking it
turret.component.get("IKAim"):aimState()
-- { ready, status, boneCount, aimErrorDegrees, weight, error }
aimErrorDegrees is the angle still between the tip's axis and the target. If
it stays large, check the axis before anything else.