@relu-interactives/spatial-ecs
@relu-interactives/spatial-ecs / index / twoBoneIK
Function: twoBoneIK() ​
ts
function twoBoneIK(
upper,
lower,
end,
target,
pole,
forward?): number;Defined in: animation/ik.ts:43
Two-bone IK: rotates upper and lower so end's origin (the wrist or ankle) reaches target, bending toward pole (pass the animated elbow/knee position to keep the animation's style). Unreachable targets are reached for as far as the limb allows. Returns how far the end stayed from the target (0 when reachable). forward is the way the character faces, for a limb too straight to say which way it bends.
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
upper | Object3D | undefined |
lower | Object3D | undefined |
end | Object3D | undefined |
target | Vector3 | undefined |
pole | Vector3 | undefined |
forward | Vector3 | FORWARD |
Returns ​
number

