1
0
Fork 0
This commit is contained in:
忘忧の 2025-02-28 01:35:55 +01:00 committed by GitHub
commit b12c264157
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 40 additions and 7 deletions

View File

@ -924,8 +924,19 @@ void GodotPhysicsServer2D::body_get_collision_exceptions(RID p_body, List<RID> *
GodotBody2D *body = body_owner.get_or_null(p_body);
ERR_FAIL_NULL(body);
for (int i = 0; i < body->get_exceptions().size(); i++) {
p_exceptions->push_back(body->get_exceptions()[i]);
const VSet<RID> &exceptions = body->get_exceptions();
LocalVector<RID> invalid_exceptions;
for (int i = 0; i < exceptions.size(); i++) {
RID exception = exceptions[i];
if (body_owner.owns(exception)) {
p_exceptions->push_back(exception);
} else {
invalid_exceptions.push_back(exception);
}
}
for (RID invalid_body : invalid_exceptions) {
body->remove_exception(invalid_body);
}
}

View File

@ -850,8 +850,19 @@ void GodotPhysicsServer3D::body_get_collision_exceptions(RID p_body, List<RID> *
GodotBody3D *body = body_owner.get_or_null(p_body);
ERR_FAIL_NULL(body);
for (int i = 0; i < body->get_exceptions().size(); i++) {
p_exceptions->push_back(body->get_exceptions()[i]);
const VSet<RID> &exceptions = body->get_exceptions();
LocalVector<RID> invalid_exceptions;
for (int i = 0; i < exceptions.size(); i++) {
RID exception = exceptions[i];
if (body_owner.owns(exception)) {
p_exceptions->push_back(exception);
} else {
invalid_exceptions.push_back(exception);
}
}
for (RID invalid_body : invalid_exceptions) {
body->remove_exception(invalid_body);
}
}

View File

@ -862,11 +862,22 @@ void JoltPhysicsServer3D::body_remove_collision_exception(RID p_body, RID p_exce
}
void JoltPhysicsServer3D::body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions) {
const JoltBody3D *body = body_owner.get_or_null(p_body);
JoltBody3D *body = body_owner.get_or_null(p_body);
ERR_FAIL_NULL(body);
for (const RID &exception : body->get_collision_exceptions()) {
const LocalVector<RID> &exceptions = body->get_collision_exceptions();
LocalVector<RID> invalid_exceptions;
for (uint32_t i = 0; i < exceptions.size(); i++) {
RID exception = exceptions[i];
if (body_owner.owns(exception)) {
p_exceptions->push_back(exception);
} else {
invalid_exceptions.push_back(exception);
}
}
for (RID invalid_body : invalid_exceptions) {
body->remove_collision_exception(invalid_body);
}
}