Skip to content

Commit

Permalink
Revert "Refactor kusudama limit cone center calculations"
Browse files Browse the repository at this point in the history
This reverts commit a150212d43e99017813139f33f8e56685f521f2d.
  • Loading branch information
fire committed Nov 5, 2023
1 parent 8144858 commit f78b5b2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/many_bone_ik_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down

0 comments on commit f78b5b2

Please sign in to comment.