skeleton_ik.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  1. /*************************************************************************/
  2. /* skeleton_ik.cpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. /**
  31. * @author AndreaCatania
  32. */
  33. #include "skeleton_ik.h"
  34. #ifndef _3D_DISABLED
  35. FabrikInverseKinematic::ChainItem *FabrikInverseKinematic::ChainItem::find_child(const BoneId p_bone_id) {
  36. for (int i = childs.size() - 1; 0 <= i; --i) {
  37. if (p_bone_id == childs[i].bone) {
  38. return &childs.write[i];
  39. }
  40. }
  41. return NULL;
  42. }
  43. FabrikInverseKinematic::ChainItem *FabrikInverseKinematic::ChainItem::add_child(const BoneId p_bone_id) {
  44. const int infant_child_id = childs.size();
  45. childs.resize(infant_child_id + 1);
  46. childs.write[infant_child_id].bone = p_bone_id;
  47. childs.write[infant_child_id].parent_item = this;
  48. return &childs.write[infant_child_id];
  49. }
  50. /// Build a chain that starts from the root to tip
  51. bool FabrikInverseKinematic::build_chain(Task *p_task, bool p_force_simple_chain) {
  52. ERR_FAIL_COND_V(-1 == p_task->root_bone, false);
  53. Chain &chain(p_task->chain);
  54. chain.tips.resize(p_task->end_effectors.size());
  55. chain.chain_root.bone = p_task->root_bone;
  56. chain.chain_root.initial_transform = p_task->skeleton->get_bone_global_pose(chain.chain_root.bone);
  57. chain.chain_root.current_pos = chain.chain_root.initial_transform.origin;
  58. chain.chain_root.pb = p_task->skeleton->get_physical_bone(chain.chain_root.bone);
  59. chain.middle_chain_item = NULL;
  60. // Holds all IDs that are composing a single chain in reverse order
  61. Vector<BoneId> chain_ids;
  62. // This is used to know the chain size
  63. int sub_chain_size;
  64. // Resize only one time in order to fit all joints for performance reason
  65. chain_ids.resize(p_task->skeleton->get_bone_count());
  66. for (int x = p_task->end_effectors.size() - 1; 0 <= x; --x) {
  67. const EndEffector *ee(&p_task->end_effectors[x]);
  68. ERR_FAIL_COND_V(p_task->root_bone >= ee->tip_bone, false);
  69. ERR_FAIL_INDEX_V(ee->tip_bone, p_task->skeleton->get_bone_count(), false);
  70. sub_chain_size = 0;
  71. // Picks all IDs that composing a single chain in reverse order (except the root)
  72. BoneId chain_sub_tip(ee->tip_bone);
  73. while (chain_sub_tip > p_task->root_bone) {
  74. chain_ids.write[sub_chain_size++] = chain_sub_tip;
  75. chain_sub_tip = p_task->skeleton->get_bone_parent(chain_sub_tip);
  76. }
  77. BoneId middle_chain_item_id = (((float)sub_chain_size) * 0.5);
  78. // Build chain by reading chain ids in reverse order
  79. // For each chain item id will be created a ChainItem if doesn't exists
  80. ChainItem *sub_chain(&chain.chain_root);
  81. for (int i = sub_chain_size - 1; 0 <= i; --i) {
  82. ChainItem *child_ci(sub_chain->find_child(chain_ids[i]));
  83. if (!child_ci) {
  84. child_ci = sub_chain->add_child(chain_ids[i]);
  85. child_ci->pb = p_task->skeleton->get_physical_bone(child_ci->bone);
  86. child_ci->initial_transform = p_task->skeleton->get_bone_global_pose(child_ci->bone);
  87. child_ci->current_pos = child_ci->initial_transform.origin;
  88. if (child_ci->parent_item) {
  89. child_ci->length = (child_ci->current_pos - child_ci->parent_item->current_pos).length();
  90. }
  91. }
  92. sub_chain = child_ci;
  93. if (middle_chain_item_id == i) {
  94. chain.middle_chain_item = child_ci;
  95. }
  96. }
  97. if (!middle_chain_item_id)
  98. chain.middle_chain_item = NULL;
  99. // Initialize current tip
  100. chain.tips.write[x].chain_item = sub_chain;
  101. chain.tips.write[x].end_effector = ee;
  102. if (p_force_simple_chain) {
  103. // NOTE:
  104. // This is an "hack" that force to create only one tip per chain since the solver of multi tip (end effector)
  105. // is not yet created.
  106. // Remove this code when this is done
  107. break;
  108. }
  109. }
  110. return true;
  111. }
  112. void FabrikInverseKinematic::update_chain(const Skeleton *p_sk, ChainItem *p_chain_item) {
  113. if (!p_chain_item)
  114. return;
  115. p_chain_item->initial_transform = p_sk->get_bone_global_pose(p_chain_item->bone);
  116. p_chain_item->current_pos = p_chain_item->initial_transform.origin;
  117. for (int i = p_chain_item->childs.size() - 1; 0 <= i; --i) {
  118. update_chain(p_sk, &p_chain_item->childs.write[i]);
  119. }
  120. }
  121. void FabrikInverseKinematic::solve_simple(Task *p_task, bool p_solve_magnet) {
  122. real_t distance_to_goal(1e4);
  123. real_t previous_distance_to_goal(0);
  124. int can_solve(p_task->max_iterations);
  125. while (distance_to_goal > p_task->min_distance && Math::abs(previous_distance_to_goal - distance_to_goal) > 0.005 && can_solve) {
  126. previous_distance_to_goal = distance_to_goal;
  127. --can_solve;
  128. solve_simple_backwards(p_task->chain, p_solve_magnet);
  129. solve_simple_forwards(p_task->chain, p_solve_magnet);
  130. distance_to_goal = (p_task->chain.tips[0].chain_item->current_pos - p_task->chain.tips[0].end_effector->goal_transform.origin).length();
  131. }
  132. }
  133. void FabrikInverseKinematic::solve_simple_backwards(Chain &r_chain, bool p_solve_magnet) {
  134. if (p_solve_magnet && !r_chain.middle_chain_item) {
  135. return;
  136. }
  137. Vector3 goal;
  138. ChainItem *sub_chain_tip;
  139. if (p_solve_magnet) {
  140. goal = r_chain.magnet_position;
  141. sub_chain_tip = r_chain.middle_chain_item;
  142. } else {
  143. goal = r_chain.tips[0].end_effector->goal_transform.origin;
  144. sub_chain_tip = r_chain.tips[0].chain_item;
  145. }
  146. while (sub_chain_tip) {
  147. sub_chain_tip->current_pos = goal;
  148. if (sub_chain_tip->parent_item) {
  149. // Not yet in the chain root
  150. // So calculate next goal location
  151. const Vector3 look_parent((sub_chain_tip->parent_item->current_pos - sub_chain_tip->current_pos).normalized());
  152. goal = sub_chain_tip->current_pos + (look_parent * sub_chain_tip->length);
  153. // [TODO] Constraints goes here
  154. }
  155. sub_chain_tip = sub_chain_tip->parent_item;
  156. }
  157. }
  158. void FabrikInverseKinematic::solve_simple_forwards(Chain &r_chain, bool p_solve_magnet) {
  159. if (p_solve_magnet && !r_chain.middle_chain_item) {
  160. return;
  161. }
  162. ChainItem *sub_chain_root(&r_chain.chain_root);
  163. Vector3 origin(r_chain.chain_root.initial_transform.origin);
  164. while (sub_chain_root) { // Reach the tip
  165. sub_chain_root->current_pos = origin;
  166. if (!sub_chain_root->childs.empty()) {
  167. ChainItem &child(sub_chain_root->childs.write[0]);
  168. // Is not tip
  169. // So calculate next origin location
  170. // Look child
  171. sub_chain_root->current_ori = (child.current_pos - sub_chain_root->current_pos).normalized();
  172. origin = sub_chain_root->current_pos + (sub_chain_root->current_ori * child.length);
  173. // [TODO] Constraints goes here
  174. if (p_solve_magnet && sub_chain_root == r_chain.middle_chain_item) {
  175. // In case of magnet solving this is the tip
  176. sub_chain_root = NULL;
  177. } else {
  178. sub_chain_root = &child;
  179. }
  180. } else {
  181. // Is tip
  182. sub_chain_root = NULL;
  183. }
  184. }
  185. }
  186. FabrikInverseKinematic::Task *FabrikInverseKinematic::create_simple_task(Skeleton *p_sk, BoneId root_bone, BoneId tip_bone, const Transform &goal_transform) {
  187. FabrikInverseKinematic::EndEffector ee;
  188. ee.tip_bone = tip_bone;
  189. Task *task(memnew(Task));
  190. task->skeleton = p_sk;
  191. task->root_bone = root_bone;
  192. task->end_effectors.push_back(ee);
  193. task->goal_global_transform = goal_transform;
  194. if (!build_chain(task)) {
  195. free_task(task);
  196. return NULL;
  197. }
  198. return task;
  199. }
  200. void FabrikInverseKinematic::free_task(Task *p_task) {
  201. if (p_task)
  202. memdelete(p_task);
  203. }
  204. void FabrikInverseKinematic::set_goal(Task *p_task, const Transform &p_goal) {
  205. p_task->goal_global_transform = p_goal;
  206. }
  207. void FabrikInverseKinematic::make_goal(Task *p_task, const Transform &p_inverse_transf, real_t blending_delta) {
  208. if (blending_delta >= 0.99f) {
  209. // Update the end_effector (local transform) without blending
  210. p_task->end_effectors.write[0].goal_transform = p_inverse_transf * p_task->goal_global_transform;
  211. } else {
  212. // End effector in local transform
  213. const Transform end_effector_pose(p_task->skeleton->get_bone_global_pose(p_task->end_effectors.write[0].tip_bone));
  214. // Update the end_effector (local transform) by blending with current pose
  215. p_task->end_effectors.write[0].goal_transform = end_effector_pose.interpolate_with(p_inverse_transf * p_task->goal_global_transform, blending_delta);
  216. }
  217. }
  218. void FabrikInverseKinematic::solve(Task *p_task, real_t blending_delta, bool override_tip_basis, bool p_use_magnet, const Vector3 &p_magnet_position) {
  219. if (blending_delta <= 0.01f) {
  220. return; // Skip solving
  221. }
  222. make_goal(p_task, p_task->skeleton->get_global_transform().affine_inverse().scaled(p_task->skeleton->get_global_transform().get_basis().get_scale()), blending_delta);
  223. update_chain(p_task->skeleton, &p_task->chain.chain_root);
  224. if (p_use_magnet && p_task->chain.middle_chain_item) {
  225. p_task->chain.magnet_position = p_task->chain.middle_chain_item->initial_transform.origin.linear_interpolate(p_magnet_position, blending_delta);
  226. solve_simple(p_task, true);
  227. }
  228. solve_simple(p_task, false);
  229. // Assign new bone position.
  230. ChainItem *ci(&p_task->chain.chain_root);
  231. while (ci) {
  232. Transform new_bone_pose(ci->initial_transform);
  233. new_bone_pose.origin = ci->current_pos;
  234. if (!ci->childs.empty()) {
  235. /// Rotate basis
  236. const Vector3 initial_ori((ci->childs[0].initial_transform.origin - ci->initial_transform.origin).normalized());
  237. const Vector3 rot_axis(initial_ori.cross(ci->current_ori).normalized());
  238. if (rot_axis[0] != 0 && rot_axis[1] != 0 && rot_axis[2] != 0) {
  239. const real_t rot_angle(Math::acos(CLAMP(initial_ori.dot(ci->current_ori), -1, 1)));
  240. new_bone_pose.basis.rotate(rot_axis, rot_angle);
  241. }
  242. } else {
  243. // Set target orientation to tip
  244. if (override_tip_basis)
  245. new_bone_pose.basis = p_task->chain.tips[0].end_effector->goal_transform.basis;
  246. else
  247. new_bone_pose.basis = new_bone_pose.basis * p_task->chain.tips[0].end_effector->goal_transform.basis;
  248. }
  249. p_task->skeleton->set_bone_global_pose(ci->bone, new_bone_pose);
  250. if (!ci->childs.empty())
  251. ci = &ci->childs.write[0];
  252. else
  253. ci = NULL;
  254. }
  255. }
  256. void SkeletonIK::_validate_property(PropertyInfo &property) const {
  257. if (property.name == "root_bone" || property.name == "tip_bone") {
  258. if (skeleton) {
  259. String names;
  260. for (int i = 0; i < skeleton->get_bone_count(); i++) {
  261. if (i > 0)
  262. names += ",";
  263. names += skeleton->get_bone_name(i);
  264. }
  265. property.hint = PROPERTY_HINT_ENUM;
  266. property.hint_string = names;
  267. } else {
  268. property.hint = PROPERTY_HINT_NONE;
  269. property.hint_string = "";
  270. }
  271. }
  272. }
  273. void SkeletonIK::_bind_methods() {
  274. ClassDB::bind_method(D_METHOD("set_root_bone", "root_bone"), &SkeletonIK::set_root_bone);
  275. ClassDB::bind_method(D_METHOD("get_root_bone"), &SkeletonIK::get_root_bone);
  276. ClassDB::bind_method(D_METHOD("set_tip_bone", "tip_bone"), &SkeletonIK::set_tip_bone);
  277. ClassDB::bind_method(D_METHOD("get_tip_bone"), &SkeletonIK::get_tip_bone);
  278. ClassDB::bind_method(D_METHOD("set_interpolation", "interpolation"), &SkeletonIK::set_interpolation);
  279. ClassDB::bind_method(D_METHOD("get_interpolation"), &SkeletonIK::get_interpolation);
  280. ClassDB::bind_method(D_METHOD("set_target_transform", "target"), &SkeletonIK::set_target_transform);
  281. ClassDB::bind_method(D_METHOD("get_target_transform"), &SkeletonIK::get_target_transform);
  282. ClassDB::bind_method(D_METHOD("set_target_node", "node"), &SkeletonIK::set_target_node);
  283. ClassDB::bind_method(D_METHOD("get_target_node"), &SkeletonIK::get_target_node);
  284. ClassDB::bind_method(D_METHOD("set_override_tip_basis", "override"), &SkeletonIK::set_override_tip_basis);
  285. ClassDB::bind_method(D_METHOD("is_override_tip_basis"), &SkeletonIK::is_override_tip_basis);
  286. ClassDB::bind_method(D_METHOD("set_use_magnet", "use"), &SkeletonIK::set_use_magnet);
  287. ClassDB::bind_method(D_METHOD("is_using_magnet"), &SkeletonIK::is_using_magnet);
  288. ClassDB::bind_method(D_METHOD("set_magnet_position", "local_position"), &SkeletonIK::set_magnet_position);
  289. ClassDB::bind_method(D_METHOD("get_magnet_position"), &SkeletonIK::get_magnet_position);
  290. ClassDB::bind_method(D_METHOD("get_parent_skeleton"), &SkeletonIK::get_parent_skeleton);
  291. ClassDB::bind_method(D_METHOD("is_running"), &SkeletonIK::is_running);
  292. ClassDB::bind_method(D_METHOD("set_min_distance", "min_distance"), &SkeletonIK::set_min_distance);
  293. ClassDB::bind_method(D_METHOD("get_min_distance"), &SkeletonIK::get_min_distance);
  294. ClassDB::bind_method(D_METHOD("set_max_iterations", "iterations"), &SkeletonIK::set_max_iterations);
  295. ClassDB::bind_method(D_METHOD("get_max_iterations"), &SkeletonIK::get_max_iterations);
  296. ClassDB::bind_method(D_METHOD("start", "one_time"), &SkeletonIK::start, DEFVAL(false));
  297. ClassDB::bind_method(D_METHOD("stop"), &SkeletonIK::stop);
  298. ADD_PROPERTY(PropertyInfo(Variant::STRING, "root_bone"), "set_root_bone", "get_root_bone");
  299. ADD_PROPERTY(PropertyInfo(Variant::STRING, "tip_bone"), "set_tip_bone", "get_tip_bone");
  300. ADD_PROPERTY(PropertyInfo(Variant::REAL, "interpolation", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_interpolation", "get_interpolation");
  301. ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "target"), "set_target_transform", "get_target_transform");
  302. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "override_tip_basis"), "set_override_tip_basis", "is_override_tip_basis");
  303. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_magnet"), "set_use_magnet", "is_using_magnet");
  304. ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "magnet"), "set_magnet_position", "get_magnet_position");
  305. ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "target_node"), "set_target_node", "get_target_node");
  306. ADD_PROPERTY(PropertyInfo(Variant::REAL, "min_distance"), "set_min_distance", "get_min_distance");
  307. ADD_PROPERTY(PropertyInfo(Variant::INT, "max_iterations"), "set_max_iterations", "get_max_iterations");
  308. }
  309. void SkeletonIK::_notification(int p_what) {
  310. switch (p_what) {
  311. case NOTIFICATION_ENTER_TREE: {
  312. skeleton = Object::cast_to<Skeleton>(get_parent());
  313. reload_chain();
  314. } break;
  315. case NOTIFICATION_INTERNAL_PROCESS: {
  316. if (target_node_override)
  317. reload_goal();
  318. _solve_chain();
  319. } break;
  320. case NOTIFICATION_EXIT_TREE: {
  321. reload_chain();
  322. } break;
  323. }
  324. }
  325. SkeletonIK::SkeletonIK() :
  326. Node(),
  327. interpolation(1),
  328. override_tip_basis(true),
  329. use_magnet(false),
  330. min_distance(0.01),
  331. max_iterations(10),
  332. skeleton(NULL),
  333. target_node_override(NULL),
  334. task(NULL) {
  335. set_process_priority(1);
  336. }
  337. SkeletonIK::~SkeletonIK() {
  338. FabrikInverseKinematic::free_task(task);
  339. task = NULL;
  340. }
  341. void SkeletonIK::set_root_bone(const StringName &p_root_bone) {
  342. root_bone = p_root_bone;
  343. reload_chain();
  344. }
  345. StringName SkeletonIK::get_root_bone() const {
  346. return root_bone;
  347. }
  348. void SkeletonIK::set_tip_bone(const StringName &p_tip_bone) {
  349. tip_bone = p_tip_bone;
  350. reload_chain();
  351. }
  352. StringName SkeletonIK::get_tip_bone() const {
  353. return tip_bone;
  354. }
  355. void SkeletonIK::set_interpolation(real_t p_interpolation) {
  356. interpolation = p_interpolation;
  357. }
  358. real_t SkeletonIK::get_interpolation() const {
  359. return interpolation;
  360. }
  361. void SkeletonIK::set_target_transform(const Transform &p_target) {
  362. target = p_target;
  363. reload_goal();
  364. }
  365. const Transform &SkeletonIK::get_target_transform() const {
  366. return target;
  367. }
  368. void SkeletonIK::set_target_node(const NodePath &p_node) {
  369. target_node_path_override = p_node;
  370. target_node_override = NULL;
  371. reload_goal();
  372. }
  373. NodePath SkeletonIK::get_target_node() {
  374. return target_node_path_override;
  375. }
  376. void SkeletonIK::set_override_tip_basis(bool p_override) {
  377. override_tip_basis = p_override;
  378. }
  379. bool SkeletonIK::is_override_tip_basis() const {
  380. return override_tip_basis;
  381. }
  382. void SkeletonIK::set_use_magnet(bool p_use) {
  383. use_magnet = p_use;
  384. }
  385. bool SkeletonIK::is_using_magnet() const {
  386. return use_magnet;
  387. }
  388. void SkeletonIK::set_magnet_position(const Vector3 &p_local_position) {
  389. magnet_position = p_local_position;
  390. }
  391. const Vector3 &SkeletonIK::get_magnet_position() const {
  392. return magnet_position;
  393. }
  394. void SkeletonIK::set_min_distance(real_t p_min_distance) {
  395. min_distance = p_min_distance;
  396. }
  397. void SkeletonIK::set_max_iterations(int p_iterations) {
  398. max_iterations = p_iterations;
  399. }
  400. bool SkeletonIK::is_running() {
  401. return is_processing_internal();
  402. }
  403. void SkeletonIK::start(bool p_one_time) {
  404. if (p_one_time) {
  405. set_process_internal(false);
  406. _solve_chain();
  407. } else {
  408. set_process_internal(true);
  409. }
  410. }
  411. void SkeletonIK::stop() {
  412. set_process_internal(false);
  413. }
  414. Transform SkeletonIK::_get_target_transform() {
  415. if (!target_node_override && !target_node_path_override.is_empty())
  416. target_node_override = Object::cast_to<Spatial>(get_node(target_node_path_override));
  417. if (target_node_override)
  418. return target_node_override->get_global_transform();
  419. else
  420. return target;
  421. }
  422. void SkeletonIK::reload_chain() {
  423. FabrikInverseKinematic::free_task(task);
  424. task = NULL;
  425. if (!skeleton)
  426. return;
  427. task = FabrikInverseKinematic::create_simple_task(skeleton, skeleton->find_bone(root_bone), skeleton->find_bone(tip_bone), _get_target_transform());
  428. if (task) {
  429. task->max_iterations = max_iterations;
  430. task->min_distance = min_distance;
  431. }
  432. }
  433. void SkeletonIK::reload_goal() {
  434. if (!task)
  435. return;
  436. FabrikInverseKinematic::set_goal(task, _get_target_transform());
  437. }
  438. void SkeletonIK::_solve_chain() {
  439. if (!task)
  440. return;
  441. FabrikInverseKinematic::solve(task, interpolation, override_tip_basis, use_magnet, magnet_position);
  442. }
  443. #endif // _3D_DISABLED