Skip to content

Commit 1867600

Browse files
committed
Merge pull request #113285 from TokageItLab/ik-remove-penetrate-check
Remove `is_penetrated` check from IK as role overlap/excessive behavior
2 parents d1b9e51 + 390e64f commit 1867600

File tree

2 files changed

+0
-29
lines changed

2 files changed

+0
-29
lines changed

scene/3d/iterate_ik_3d.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -522,10 +522,6 @@ void IterateIK3D::_process_joints(double p_delta, Skeleton3D *p_skeleton, Iterat
522522
double distance_to_target_sq = INFINITY;
523523
int iteration_count = 0;
524524

525-
if (p_setting->is_penetrated(p_destination)) {
526-
return;
527-
}
528-
529525
// To prevent oscillation, if it has been processed at least once and target was reached, abort iterating.
530526
if (p_setting->simulated) {
531527
distance_to_target_sq = p_setting->chain[p_setting->chain.size() - 1].distance_squared_to(p_destination);

scene/3d/iterate_ik_3d.h

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -149,31 +149,6 @@ class IterateIK3D : public ChainIK3D {
149149

150150
bool simulated = false;
151151

152-
bool is_penetrated(const Vector3 &p_destination) {
153-
bool ret = false;
154-
Vector3 chain_dir = (chain[chain.size() - 1] - chain[0]).normalized();
155-
bool is_straight = true;
156-
for (uint32_t i = 1; i < chain.size() - 1; i++) {
157-
Vector3 dir = (chain[i] - chain[0]).normalized();
158-
if (!dir.is_equal_approx(chain_dir)) {
159-
is_straight = false;
160-
break;
161-
}
162-
}
163-
if (is_straight) {
164-
Vector3 to_target = (p_destination - chain[0]);
165-
double proj = to_target.dot(chain_dir);
166-
double total_length = 0;
167-
for (uint32_t i = 0; i < solver_info_list.size(); i++) {
168-
if (solver_info_list[i]) {
169-
total_length += solver_info_list[i]->length;
170-
}
171-
}
172-
ret = proj >= 0 && proj <= total_length && (to_target.normalized().is_equal_approx(chain_dir));
173-
}
174-
return ret;
175-
}
176-
177152
// Make rotation as bone pose from chain coordinates.
178153
// p_extra is delta angle limitation.
179154
void cache_current_joint_rotations(Skeleton3D *p_skeleton, double p_angular_delta_limit = Math::PI) {

0 commit comments

Comments
 (0)