Merge pull request #37826 from nekomatata/direct-body-state-sleep

Fix set_sleep_state in Bullet body direct state
This commit is contained in:
Rémi Verschelde 2020-04-14 12:53:20 +02:00 committed by GitHub
commit e0eb9a8ae4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View file

@ -138,8 +138,8 @@ void BulletPhysicsDirectBodyState3D::apply_torque_impulse(const Vector3 &p_impul
body->apply_torque_impulse(p_impulse); body->apply_torque_impulse(p_impulse);
} }
void BulletPhysicsDirectBodyState3D::set_sleep_state(bool p_enable) { void BulletPhysicsDirectBodyState3D::set_sleep_state(bool p_sleep) {
body->set_activation_state(p_enable); body->set_activation_state(!p_sleep);
} }
bool BulletPhysicsDirectBodyState3D::is_sleeping() const { bool BulletPhysicsDirectBodyState3D::is_sleeping() const {

View file

@ -117,7 +117,7 @@ public:
virtual void apply_impulse(const Vector3 &p_pos, const Vector3 &p_impulse); virtual void apply_impulse(const Vector3 &p_pos, const Vector3 &p_impulse);
virtual void apply_torque_impulse(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 bool is_sleeping() const;
virtual int get_contact_count() const; virtual int get_contact_count() const;

View file

@ -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_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 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 bool is_sleeping() const { return !body->is_active(); }
virtual int get_contact_count() const { return body->contact_count; } virtual int get_contact_count() const { return body->contact_count; }

View file

@ -70,7 +70,7 @@ public:
virtual void apply_impulse(const Vector3 &p_pos, const Vector3 &p_j) = 0; 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 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 bool is_sleeping() const = 0;
virtual int get_contact_count() const = 0; virtual int get_contact_count() const = 0;