Class InverseKinematics
The Inverse Kinematics (IK) utility library.
Inheritance
Assembly: FlaxEngine.dll
File: Engine/Animations/InverseKinematics.h
Syntax
public class InverseKinematics
Methods
SolveAimIK(const Transform& node, const Vector3& target, Quaternion& outNodeCorrection)
Rotates a node so it aims at a target. Solves the transformation (rotation) that needs to be applied to the node such that a provided forward vector (in node local space) aims at the target position (in skeleton model space).
Declaration
public static void SolveAimIK(const Transform& node, const Vector3& target, Quaternion& outNodeCorrection)
Parameters
Transform
node
The node transformation (in model space). |
Vector3
target
The target position to aim at (in model space). |
Quaternion
outNodeCorrection
The calculated output node correction (in model- space). It needs to be multiplied with node model space quaternion. |
SolveTwoBoneIK(Transform& rootNode, Transform& jointNode, Transform& targetNode, const Vector3& target, const Vector3& jointTarget, bool allowStretching=false, float maxStretchScale=1.5f)
Performs inverse kinematic on a three nodes chain (must be ancestors).
Declaration
public static void SolveTwoBoneIK(Transform& rootNode, Transform& jointNode, Transform& targetNode, const Vector3& target, const Vector3& jointTarget, bool allowStretching=false, float maxStretchScale=1.5f)
Parameters
Transform
rootNode
The start node transformation (in model space). |
Transform
jointNode
The middle node transformation (in model space). |
Transform
targetNode
The end node transformation (in model space). |
Vector3
target
The target position of the end node to reach (in model space). |
Vector3
jointTarget
The target position of the middle node to face into (in model space). |
bool
allowStretching
True if allow bones stretching, otherwise bone lengths will be preserved when trying to reach the target. |
float
maxStretchScale
The maximum scale when stretching bones. Used only if allowStretching is true. |