Log inGet started
Package

IKChain.component

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

IKChain

Solves an arbitrary bone chain so its tip reaches a target. It names bones directly instead of resolving canonical humanoid roles, so it works on any rig at all — a crane boom, a robot arm, a tentacle, a lamp, a humanoid limb.

crane.component.add("IKChain", {
    rootBone = "boom_base",
    tipBone = "boom_tip",
    target = hookRef,
    solver = "ccd",
})

Fields

  • rootBone, tipBone — the chain's ends, named as the rig names them. The tip must be a descendant of the root; the bones between come from the rig's own parent links. Use ik.bones to see what the rig actually calls things.
  • target — an EntityRef. Bones are strings, targets are refs.
  • solver — "ccd", "fabrik", or "twoBone". CCD holds joint limits well on short runs; FABRIK converges faster on long floppy ones.
  • weight — blends against the incoming animation. 0 is an exact pass-through and skips the solve entirely.
  • iterations, tolerance — the iterative solvers' budget and stopping error.

Checking it

crane.component.get("IKChain"):chainState()
-- { ready, status, boneCount, reach, distanceToTarget, solver, weight, error }

status says in words what it is doing when ready is false — usually a body whose rig has not arrived yet, which clears on its own unless the engine is paused. distanceToTarget is the residual after solving, not the distance to compare against reach; for that, use ik.reach.