diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-01-24 11:53:25 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2019-01-24 12:15:54 +0100 |
commit | 63b487e49ccf6cce5e259f6d4d2fcb9c01158dc5 (patch) | |
tree | f4e01ba82feaabe63571d78fccd1598adf838dea | |
parent | 7b4e7d56629638e73e30c4b39ca7494bda223960 (diff) |
Fix PhysicsBody ignoring set_friction/bounce with default value
The intent was to avoid creating a physics override to set a default value
that doesn't make a difference, but as #22406 shows it can be necessary to
set the default value *back* after an override was created to set a non-default
value.
Fixes #22406.
-rw-r--r-- | scene/3d/physics_body.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index 22da51ac30..50abbd483a 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -188,7 +188,7 @@ PhysicsBody::PhysicsBody(PhysicsServer::BodyMode p_mode) : #ifndef DISABLE_DEPRECATED void StaticBody::set_friction(real_t p_friction) { - if (p_friction == 1.0) { // default value, don't create an override for that + if (p_friction == 1.0 && physics_material_override.is_null()) { // default value, don't create an override for that return; } @@ -218,7 +218,7 @@ real_t StaticBody::get_friction() const { void StaticBody::set_bounce(real_t p_bounce) { - if (p_bounce == 0.0) { // default value, don't create an override for that + if (p_bounce == 0.0 && physics_material_override.is_null()) { // default value, don't create an override for that return; } @@ -632,7 +632,7 @@ real_t RigidBody::get_weight() const { #ifndef DISABLE_DEPRECATED void RigidBody::set_friction(real_t p_friction) { - if (p_friction == 1.0) { // default value, don't create an override for that + if (p_friction == 1.0 && physics_material_override.is_null()) { // default value, don't create an override for that return; } @@ -661,7 +661,7 @@ real_t RigidBody::get_friction() const { void RigidBody::set_bounce(real_t p_bounce) { - if (p_bounce == 0.0) { // default value, don't create an override for that + if (p_bounce == 0.0 && physics_material_override.is_null()) { // default value, don't create an override for that return; } |