From 30b184cb0619dca37f7c779328138bf3d403660e Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Sun, 12 Apr 2020 14:39:49 +0200 Subject: [PATCH] Fix set_sleep_state in Bullet body direct state It was inverted, it should set the body to be active when sleep is disabled. --- modules/bullet/rigid_body_bullet.cpp | 4 ++-- modules/bullet/rigid_body_bullet.h | 2 +- servers/physics_3d/body_3d_sw.h | 2 +- servers/physics_server_3d.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp index fc4e1d57def..a4f9affa954 100644 --- a/modules/bullet/rigid_body_bullet.cpp +++ b/modules/bullet/rigid_body_bullet.cpp @@ -138,8 +138,8 @@ void BulletPhysicsDirectBodyState3D::apply_torque_impulse(const Vector3 &p_impul body->apply_torque_impulse(p_impulse); } -void BulletPhysicsDirectBodyState3D::set_sleep_state(bool p_enable) { - body->set_activation_state(p_enable); +void BulletPhysicsDirectBodyState3D::set_sleep_state(bool p_sleep) { + body->set_activation_state(!p_sleep); } bool BulletPhysicsDirectBodyState3D::is_sleeping() const { diff --git a/modules/bullet/rigid_body_bullet.h b/modules/bullet/rigid_body_bullet.h index 95491b1e626..420b5cc443c 100644 --- a/modules/bullet/rigid_body_bullet.h +++ b/modules/bullet/rigid_body_bullet.h @@ -117,7 +117,7 @@ public: virtual void apply_impulse(const Vector3 &p_pos, const Vector3 &p_impulse); virtual void apply_torque_impulse(const Vector3 &p_impulse); - virtual void set_sleep_state(bool p_enable); + virtual void set_sleep_state(bool p_sleep); virtual bool is_sleeping() const; virtual int get_contact_count() const; diff --git a/servers/physics_3d/body_3d_sw.h b/servers/physics_3d/body_3d_sw.h index b553cf06709..96e8c61020b 100644 --- a/servers/physics_3d/body_3d_sw.h +++ b/servers/physics_3d/body_3d_sw.h @@ -421,7 +421,7 @@ public: virtual void apply_impulse(const Vector3 &p_pos, const Vector3 &p_j) { body->apply_impulse(p_pos, p_j); } virtual void apply_torque_impulse(const Vector3 &p_j) { body->apply_torque_impulse(p_j); } - virtual void set_sleep_state(bool p_enable) { body->set_active(!p_enable); } + virtual void set_sleep_state(bool p_sleep) { body->set_active(!p_sleep); } virtual bool is_sleeping() const { return !body->is_active(); } virtual int get_contact_count() const { return body->contact_count; } diff --git a/servers/physics_server_3d.h b/servers/physics_server_3d.h index a2f08b3ed87..8ea8b224559 100644 --- a/servers/physics_server_3d.h +++ b/servers/physics_server_3d.h @@ -70,7 +70,7 @@ public: virtual void apply_impulse(const Vector3 &p_pos, const Vector3 &p_j) = 0; virtual void apply_torque_impulse(const Vector3 &p_j) = 0; - virtual void set_sleep_state(bool p_enable) = 0; + virtual void set_sleep_state(bool p_sleep) = 0; virtual bool is_sleeping() const = 0; virtual int get_contact_count() const = 0;