null to disable IK (safe to call unconditionally per React hook rules).
Usage
With Custom Solver
useIkController is intentionally open-ended. You can pass ikSolveFn for your own IK implementation, wrap the returned IkContextValue in your own hook, or build a plugin-style React component that reads/writes the IK target, simulation data, or actuator controls directly. Built-in helpers such as IkGizmo and useKeyboardIkTarget are optional consumers of the same controller state, not required control paths.
Config
Pass anIkConfig object or null:
By default,
useIkController infers scalar hinge/slide joints by walking from the site body toward the model root. For nonstandard actuator layouts, pass explicit ordered names or a selector:
Return Value
ReturnsIkContextValue | null. Returns null when config is null.
Methods
Refs
Example: Keyboard/Gizmo Coexistence
A common pattern is disabling IK when keyboard control takes over. Pass theik value to your controller:
Example: Waypoint Following
Built-in Solver Details
The default solver uses Damped Least-Squares (DLS) with finite-difference Jacobian:- Position weight: 1.0
- Rotation weight: 0.3
- Tolerance: 1e-3
- Finite-difference epsilon: 1e-6
- Method: Finite-difference Jacobian + pseudoinverse
Reset Behavior
When the simulation is reset (viaapi.reset(), api.applyKeyframe(), or api.loadScene()), useIkController automatically:
- Syncs the gizmo to the current site position
- Stops any in-progress gizmo animation
- Disables IK solving