Merge pull request #55167 from brennengreen/conditional-wakeup

Add GodotBody2D/GodotBody3D conditional wakeup when setting gravity_scale param
This commit is contained in:
Camille Mohr-Daurat 2021-11-22 11:43:55 -07:00 committed by GitHub
commit dbef4bbd98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -185,6 +185,9 @@ void GodotBody2D::set_param(PhysicsServer2D::BodyParameter p_param, const Varian
_update_transform_dependent();
} break;
case PhysicsServer2D::BODY_PARAM_GRAVITY_SCALE: {
if (Math::is_zero_approx(gravity_scale)) {
wakeup();
}
gravity_scale = p_value;
} break;
case PhysicsServer2D::BODY_PARAM_LINEAR_DAMP_MODE: {

View File

@ -227,6 +227,9 @@ void GodotBody3D::set_param(PhysicsServer3D::BodyParameter p_param, const Varian
_update_transform_dependent();
} break;
case PhysicsServer3D::BODY_PARAM_GRAVITY_SCALE: {
if (Math::is_zero_approx(gravity_scale)) {
wakeup();
}
gravity_scale = p_value;
} break;
case PhysicsServer3D::BODY_PARAM_LINEAR_DAMP_MODE: {