summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorBrennen Green <brennengreen@outlook.com>2021-11-20 11:25:27 -0500
committerBrennen Green <brennengreen@outlook.com>2021-11-22 12:03:50 -0500
commit37993f0c0ca9556fd760da8c14056378fdaf0994 (patch)
tree27aebdc5a407d5d0e56a0b46afb6e253564b68da /servers
parent66ba19a435fb53ce53c1c0a355920cf8fb111e58 (diff)
Add wakeup() conditional if previous gravity was 0
Diffstat (limited to 'servers')
-rw-r--r--servers/physics_2d/godot_body_2d.cpp3
-rw-r--r--servers/physics_3d/godot_body_3d.cpp3
2 files changed, 6 insertions, 0 deletions
diff --git a/servers/physics_2d/godot_body_2d.cpp b/servers/physics_2d/godot_body_2d.cpp
index 9b97583300..6d1c5539aa 100644
--- a/servers/physics_2d/godot_body_2d.cpp
+++ b/servers/physics_2d/godot_body_2d.cpp
@@ -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: {
diff --git a/servers/physics_3d/godot_body_3d.cpp b/servers/physics_3d/godot_body_3d.cpp
index 0e21dd303f..40d946655d 100644
--- a/servers/physics_3d/godot_body_3d.cpp
+++ b/servers/physics_3d/godot_body_3d.cpp
@@ -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: {