![]() |
Skylicht Engine
|
Simple 2-bone Inverse Kinematics (IK) solver. More...
#include <Animation/IK/CIKSolver.h>
Public Member Functions | |
| void | solveIK (const core::vector3df &startJointPos, const core::vector3df &midJointPos, const core::vector3df &endJointPos, const core::vector3df &targetPos, const core::vector3df &poleVector, float twistValue, core::quaternion &qStart, core::quaternion &qMid) |
| Solves the Inverse Kinematics (IK) for a 2-bone chain (e.g., limb). | |
Simple 2-bone Inverse Kinematics (IK) solver.
Example: Solving IK for an arm
| void Skylicht::CIKSolver::solveIK | ( | const core::vector3df & | startJointPos, |
| const core::vector3df & | midJointPos, | ||
| const core::vector3df & | endJointPos, | ||
| const core::vector3df & | targetPos, | ||
| const core::vector3df & | poleVector, | ||
| float | twistValue, | ||
| core::quaternion & | qStart, | ||
| core::quaternion & | qMid ) |
Solves the Inverse Kinematics (IK) for a 2-bone chain (e.g., limb).
Given the positions of three joints and a target, it calculates the required rotations for the start and middle joints to reach the target.
| startJointPos | Current world position of the root joint (e.g., Shoulder). |
| midJointPos | Current world position of the middle joint (e.g., Elbow). |
| endJointPos | Current world position of the effector joint (e.g., Hand). |
| targetPos | Target world position for the effector joint. |
| poleVector | World direction defining the plane of rotation (where the knee/elbow points). |
| twistValue | Additional rotation along the chain direction in degrees. |
| qStart | [out] Output rotation quaternion for the start joint. |
| qMid | [out] Output rotation quaternion for the middle joint. |