Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions scene/3d/iterate_ik_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,10 +522,6 @@ void IterateIK3D::_process_joints(double p_delta, Skeleton3D *p_skeleton, Iterat
double distance_to_target_sq = INFINITY;
int iteration_count = 0;

if (p_setting->is_penetrated(p_destination)) {
return;
}

// To prevent oscillation, if it has been processed at least once and target was reached, abort iterating.
if (p_setting->simulated) {
distance_to_target_sq = p_setting->chain[p_setting->chain.size() - 1].distance_squared_to(p_destination);
Expand Down
25 changes: 0 additions & 25 deletions scene/3d/iterate_ik_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,31 +149,6 @@ class IterateIK3D : public ChainIK3D {

bool simulated = false;

bool is_penetrated(const Vector3 &p_destination) {
bool ret = false;
Vector3 chain_dir = (chain[chain.size() - 1] - chain[0]).normalized();
bool is_straight = true;
for (uint32_t i = 1; i < chain.size() - 1; i++) {
Vector3 dir = (chain[i] - chain[0]).normalized();
if (!dir.is_equal_approx(chain_dir)) {
is_straight = false;
break;
}
}
if (is_straight) {
Vector3 to_target = (p_destination - chain[0]);
double proj = to_target.dot(chain_dir);
double total_length = 0;
for (uint32_t i = 0; i < solver_info_list.size(); i++) {
if (solver_info_list[i]) {
total_length += solver_info_list[i]->length;
}
}
ret = proj >= 0 && proj <= total_length && (to_target.normalized().is_equal_approx(chain_dir));
}
return ret;
}

// Make rotation as bone pose from chain coordinates.
// p_extra is delta angle limitation.
void cache_current_joint_rotations(Skeleton3D *p_skeleton, double p_angular_delta_limit = Math::PI) {
Expand Down