Improve performance of changing compound shapes when using Jolt Physics

This commit is contained in:
Mikael Hermansson
2025-01-06 14:58:50 +01:00
parent 1aaf20b1f1
commit 053d92401e
7 changed files with 104 additions and 46 deletions

View File

@@ -80,7 +80,7 @@ bool JoltArea3D::_has_pending_events() const {
}
void JoltArea3D::_add_to_space() {
jolt_shape = build_shape();
jolt_shape = build_shapes(true);
JPH::CollisionGroup::GroupID group_id = 0;
JPH::CollisionGroup::SubGroupID sub_group_id = 0;
@@ -97,7 +97,7 @@ void JoltArea3D::_add_to_space() {
jolt_settings->mCollideKinematicVsNonDynamic = true;
}
jolt_settings->SetShape(build_shape());
jolt_settings->SetShape(jolt_shape);
const JPH::BodyID new_jolt_id = space->add_rigid_body(*this, *jolt_settings);
if (new_jolt_id.IsInvalid()) {