diff --git a/src/many_bone_ik_3d.cpp b/src/many_bone_ik_3d.cpp index 61eea704..4489889b 100644 --- a/src/many_bone_ik_3d.cpp +++ b/src/many_bone_ik_3d.cpp @@ -622,11 +622,16 @@ void ManyBoneIK3D::set_kusudama_limit_cone_center(int32_t p_effector_index, int3 ERR_FAIL_INDEX(p_effector_index, kusudama_limit_cones.size()); ERR_FAIL_INDEX(p_index, kusudama_limit_cones[p_effector_index].size()); Vector4 &cone = kusudama_limit_cones.write[p_effector_index].write[p_index]; + Basis basis; + basis.set_column(0, Vector3(1, 0, 0)); + basis.set_column(1, Vector3(0, 0, -1)); + basis.set_column(2, Vector3(0, 1, 0)); if (Math::is_zero_approx(p_center.length_squared())) { cone.x = 0; cone.y = 0; cone.z = 1; } else { + p_center = basis.xform(p_center); cone.x = p_center.x; cone.y = p_center.y; cone.z = p_center.z; @@ -648,7 +653,11 @@ Vector3 ManyBoneIK3D::get_kusudama_limit_cone_center(int32_t p_constraint_index, ret.x = cone.x; ret.y = cone.y; ret.z = cone.z; - return ret; + Basis basis; + basis.set_column(0, Vector3(1, 0, 0)); + basis.set_column(1, Vector3(0, 0, -1)); + basis.set_column(2, Vector3(0, 1, 0)); + return basis.xform_inv(ret); } void ManyBoneIK3D::set_constraint_name(int32_t p_index, String p_name) {