Fix contacts not being reported properly when using Jolt Physics

This commit is contained in:
Mikael Hermansson 2025-07-12 13:18:28 +02:00
parent c6d130abd9
commit 5a16e2fc78
6 changed files with 111 additions and 1 deletions

View file

@ -161,6 +161,8 @@ void JoltBody3D::_add_to_space() {
}
void JoltBody3D::_enqueue_call_queries() {
// This method will be called from the body activation listener on multiple threads during the simulation step.
if (space != nullptr) {
space->enqueue_call_queries(&call_queries_element);
}
@ -299,6 +301,14 @@ JPH::MassProperties JoltBody3D::_calculate_mass_properties() const {
return _calculate_mass_properties(*jolt_shape);
}
void JoltBody3D::_on_wake_up() {
// This method will be called from the body activation listener on multiple threads during the simulation step.
if (_should_call_queries()) {
_enqueue_call_queries();
}
}
void JoltBody3D::_update_mass_properties() {
if (in_space()) {
jolt_body->GetMotionPropertiesUnchecked()->SetMassProperties(_calculate_allowed_dofs(), _calculate_mass_properties());