Builtin Library
README.md
IKLookAt
Turns a character's spine, neck, and head toward a target so it watches something as it moves.
guard.component.add("IKLookAt", { target = playerRef, clampAngle = 80 })
Fields
target— anEntityRef. Nil leaves the pose alone.rootBone,tipBone— an explicit chain, for a rig with no canonical spine roles. Absent, the spine-to-head run is resolved from roles.axisX/axisY/axisZ— the head's local forward, default+Z. Naming the wrong axis is the classic way to get a mangled pose: the solver faithfully points the axis you named, however strange the result.bodyWeight— the share of the turn taken by the bones below the head. 0 turns the head alone; higher brings the torso round with it.clampAngle— the largest total turn, in degrees. This is what stops a character wringing its neck round to follow something behind it.weight— blends against the incoming animation; 0 is an exact pass-through.
Checking it
guard.component.get("IKLookAt"):lookState()
-- { ready, status, boneCount, clamped, clampAngle, bodyWeight, weight, error }
clamped is the field worth watching: it distinguishes "watching the target"
from "turned as far as allowed and still facing away", which look identical in
a screenshot.