Solve a connected two-bone chain toward a world target without stretching. Positive bend rotates the second bone clockwise in screen coordinates. Origins on the second bone must be zero; the solver accepts rotation-only poses.
import { create, solveTwoBoneIK } from '@datamoc/mwg/skeleton';const rig = create([{ name: 'upper', length: 10 }, { name: 'lower', parent: 'upper', length: 10 }]);const pose = solveTwoBoneIK(rig, 'upper', 'lower', { x: 10, y: 10 }); Copy
import { create, solveTwoBoneIK } from '@datamoc/mwg/skeleton';const rig = create([{ name: 'upper', length: 10 }, { name: 'lower', parent: 'upper', length: 10 }]);const pose = solveTwoBoneIK(rig, 'upper', 'lower', { x: 10, y: 10 });
Solve a connected two-bone chain toward a world target without stretching. Positive bend rotates the second bone clockwise in screen coordinates. Origins on the second bone must be zero; the solver accepts rotation-only poses.