summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-10-25 23:36:17 +0200
committerGitHub <noreply@github.com>2019-10-25 23:36:17 +0200
commit5cdecb8227fe6d15d5f5494334df5df9cdcbda0f (patch)
treec35894bd17bc3cba9f0c0cbf4a1ee0929e12c9cd
parente38fd9a5e647a2bc01d9bfb8d82c001f730684c3 (diff)
parent13798746e7fb236930711e8c6a36fe55bcde6e5d (diff)
Merge pull request #32845 from madmiraal/rigidbody-mode-change
Activate Body(2D)SW when switching to rigid or character mode.
-rw-r--r--servers/physics/body_sw.cpp2
-rw-r--r--servers/physics_2d/body_2d_sw.cpp2
2 files changed, 4 insertions, 0 deletions
diff --git a/servers/physics/body_sw.cpp b/servers/physics/body_sw.cpp
index 7d575c57ae..ba98e14d2e 100644
--- a/servers/physics/body_sw.cpp
+++ b/servers/physics/body_sw.cpp
@@ -260,12 +260,14 @@ void BodySW::set_mode(PhysicsServer::BodyMode p_mode) {
_inv_mass = mass > 0 ? (1.0 / mass) : 0;
_set_static(false);
+ set_active(true);
} break;
case PhysicsServer::BODY_MODE_CHARACTER: {
_inv_mass = mass > 0 ? (1.0 / mass) : 0;
_set_static(false);
+ set_active(true);
angular_velocity = Vector3();
} break;
}
diff --git a/servers/physics_2d/body_2d_sw.cpp b/servers/physics_2d/body_2d_sw.cpp
index f9939e3843..de1dfc9ee7 100644
--- a/servers/physics_2d/body_2d_sw.cpp
+++ b/servers/physics_2d/body_2d_sw.cpp
@@ -238,6 +238,7 @@ void Body2DSW::set_mode(Physics2DServer::BodyMode p_mode) {
_inv_mass = mass > 0 ? (1.0 / mass) : 0;
_inv_inertia = inertia > 0 ? (1.0 / inertia) : 0;
_set_static(false);
+ set_active(true);
} break;
case Physics2DServer::BODY_MODE_CHARACTER: {
@@ -245,6 +246,7 @@ void Body2DSW::set_mode(Physics2DServer::BodyMode p_mode) {
_inv_mass = mass > 0 ? (1.0 / mass) : 0;
_inv_inertia = 0;
_set_static(false);
+ set_active(true);
angular_velocity = 0;
} break;
}