Unravel Engine C++ Reference
Loading...
Searching...
No Matches
ik_solvers.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <entt/entt.hpp>
5#include <math/math.h>
6
7namespace unravel
8{
9
10// For all position-based solvers below, the `pole` parameter is a world-space
11// hint that tells the solver which side of the (root -> end) line the
12// intermediate joints (e.g. the knee or elbow) should bend toward. Pass a
13// zero-length vector to disable the constraint - CCD and FABRIK will then
14// place intermediate joints wherever the raw solve puts them, while the
15// analytical two-bone solver will fall back to the current bend direction.
16//
17// Argument order convention (shared across the three solvers):
18// (entity, target, pole) -> (chain structure, if any) -> tuning knobs.
19auto ik_set_position_ccd(entt::handle end_effector,
20 const math::vec3& target,
21 const math::vec3& pole,
22 size_t num_bones_in_chain,
23 int max_iterations = 10,
24 float threshold = 0.001f) -> bool;
25
26auto ik_set_position_fabrik(entt::handle end_effector,
27 const math::vec3& target,
28 const math::vec3& pole,
29 size_t num_bones_in_chain,
30 int max_iterations = 10,
31 float threshold = 0.001f) -> bool;
32
33auto ik_set_position_two_bone(entt::handle end_effector,
34 const math::vec3& target,
35 const math::vec3& pole,
36 float weight = 1.0f,
37 float soften = 1.0f) -> bool;
38
39auto ik_look_at_position(entt::handle end_effector,
40 const math::vec3& target,
41 float weight = 1.0f) -> bool;
42
46auto ik_get_facing_adjustment_rotation(entt::handle end_effector) -> math::quat;
47
48} // namespace unravel
auto ik_set_position_two_bone(entt::handle end_effector, const math::vec3 &target, const math::vec3 &pole, float weight, float soften) -> bool
auto ik_set_position_fabrik(entt::handle end_effector, const math::vec3 &target, const math::vec3 &pole, size_t num_bones_in_chain, int max_iterations, float threshold) -> bool
auto ik_set_position_ccd(entt::handle end_effector, const math::vec3 &target, const math::vec3 &pole, size_t num_bones_in_chain, int max_iterations, float threshold) -> bool
auto ik_look_at_position(entt::handle end_effector, const math::vec3 &target, float weight) -> bool
auto ik_get_facing_adjustment_rotation(entt::handle end_effector) -> math::quat
Returns the armature root local rotation for the model owning this bone.