/** * code based on * https://github.com/benikabocha/saba/blob/master/src/Saba/Model/MMD/MMDIkSolver.cpp */ import type { PmxObject } from "../Loader/Parser/pmxObject"; import type { MmdRuntimeBone } from "./mmdRuntimeBone"; /** * IK solver */ export declare class IkSolver { /** * Ik solver index */ readonly index: number; /** * Iteration count * * The higher the value, the more accurate the IK solver will be, but the more expensive it will be */ get iteration(): number; set iteration(value: number); /** * Limit angle */ limitAngle: number; /** * The bone to which the IK solver is attached */ readonly ikBone: MmdRuntimeBone; /** * Ik target bone */ readonly targetBone: MmdRuntimeBone; private _iteration; private readonly _ikChains; private _canSkipWhenPhysicsEnabled; /** * Create a new IK solver * @param index Ik solver index * @param ikBone Attach bone * @param targetBone Ik target bone */ constructor(index: number, ikBone: MmdRuntimeBone, targetBone: MmdRuntimeBone); /** * Add an IK chain * * The angle constraint must be either both min max or neither * * For better performance, we do not constrain this to a type * @param bone Bone to add * @param isAffectedByPhysics Whether the bone is affected by physics * @param limitation Angle limitation */ addIkChain(bone: MmdRuntimeBone, isAffectedByPhysics: boolean, limitation?: PmxObject.Bone.IKLink["limitation"]): void; /** * If all chains are affected by physics, ik solver can be skipped */ get canSkipWhenPhysicsEnabled(): boolean; private static readonly _IkPosition; private static readonly _TargetPosition; /** * Solve IK * @param usePhysics Whether to use physics */ solve(usePhysics: boolean): void; private static readonly _ChainPosition; private static readonly _ChainTargetVector; private static readonly _ChainIkVector; private static readonly _ChainRotationAxis; private static readonly _ChainParentRotationMatrix; private static readonly _Axis; private static readonly _Rotation; private static readonly _RotationMatrix; private static readonly _Right; private static readonly _Up; private static readonly _Forward; private static readonly _Rotation2; private static readonly _Rotation3; private _solveChain; private _limitAngle; }