Godot: Areas' Replace-Combine space overrides don't work right in 3.2.3-rc6

Created on 14 Sep 2020  路  5Comments  路  Source: godotengine/godot

Godot version:
Official 3.2.3-rc6 build

OS/device including version:
Ubuntu Linux 16.04, 64-bit
GeForce GTX 970 with NVIDIA 384.130 driver
GLES3 backend
Bullet Physics

Issue description:
The behavior of Area Replace-Combine space overrides has changed in 3.2.3. I noted this originally in #41743 but I think it has a separate underlying cause since it appears to be new to 3.2.3.

Steps to reproduce:

  1. Run the attached project in 3.2.3-rc6
  2. Observe the RigidBody cube falls straight through the blue Areas (the script teleports it back to the top once it passes a certain threshold):

cb-495

The expected behavior, observed in 3.2.2 and earlier is for the blue Areas to slow the RigidBody's descent and gradually float it to the top by replacing gravity:

cb-496

Minimal reproduction project:
AreaReplaceCombine.zip

archived discussion physics

Most helpful comment

39084 fixed two issues in 3.2 with damping in Bullet physics: #19182 and #30991, but it also fixed how SpaceOverrides work.

This has had two effects on the MRP:

  1. The two areas use Replace-Combine which replaces the gravity and damping settings with this Area's settings, but allows further processing to continue. With #39084, this now correctly includes combining the world gravity (the lowest priority) and hence the large gravity seen.
  2. The two areas use a damping of 0.99. With #39084, damping is now equivalent to deceleration. This makes damping more intuitive at the cost of being less physically accurate. It also makes damping between 0.9 and 1.0 less severe; so if damping was high it will be noticeably lower than before.

I've created the following table to help make converting the damping values easier:

Damping | Old Bullet Deceleration | Godot and Fixed Bullet Deceleration
-- | -- | --
0.1 | -0.11 | -0.1
0.2 | -0.22 | -0.2
0.3 | -0.36 | -0.3
0.4 | -0.51 | -0.4
0.5 | -0.69 | -0.5
0.6 | -0.91 | -0.6
0.7 | -1.19 | -0.7
0.8 | -1.59 | -0.8
0.9 | -2.26 | -0.9
0.99 | -4.43 | -0.99
0.999 | -6.52 | -0.999
0.9999 | -8.54 | -0.9999
0.99999 | -10.48 | -0.99999
1.0 | -60 | -1.0
2 | -60 | -2
5 | -60 | -5
10 | -60 | -10
15 | -60 | -15
20 | -60 | -20
25 | -60 | -25
30 | -60 | -30
35 | -60 | -35
45 | -60 | -45
50 | -60 | -50
60 | -60 | -60

To modify the MRP to behave like it did before requires three things:

  1. Set the Areas' SpaceOverride settings to Replace. This ensures that within an Area only that Area's settings apply and the world's settings are not added.
  2. Modify the priorities of the Areas so that the second Area which is required to override the first is higher.
  3. Modify the linear damping to around 5; so it's equivalent to what it was before.
    I've attached a modified MRP for convenience:
    AreaReplaceCombine-Updated.zip

All 5 comments

The regression happened between 3.2.2-stable and 3.2.3-beta1.
Changelog: https://github.com/godotengine/godot/compare/3.2.2-stable...89f57ae12244f3269c9e3fe4684e16ec1fd2c989

The behavior in 3.2.3 RC 6 seems to be consistent between Bullet and GodotPhysics (though to test the MRP with GodotPhysics the _process method should be changed to _physics_process, otherwise the RID is invalid), so it might actually be a compat breaking bugfix and not a regression per se.

The change was caused by #39084 (reverting it restores the original behavior from 3.2.2-stable).

Most likely what's needed here is more damping now that Bullet damping is no longer way too strong.

39084 fixed two issues in 3.2 with damping in Bullet physics: #19182 and #30991, but it also fixed how SpaceOverrides work.

This has had two effects on the MRP:

  1. The two areas use Replace-Combine which replaces the gravity and damping settings with this Area's settings, but allows further processing to continue. With #39084, this now correctly includes combining the world gravity (the lowest priority) and hence the large gravity seen.
  2. The two areas use a damping of 0.99. With #39084, damping is now equivalent to deceleration. This makes damping more intuitive at the cost of being less physically accurate. It also makes damping between 0.9 and 1.0 less severe; so if damping was high it will be noticeably lower than before.

I've created the following table to help make converting the damping values easier:

Damping | Old Bullet Deceleration | Godot and Fixed Bullet Deceleration
-- | -- | --
0.1 | -0.11 | -0.1
0.2 | -0.22 | -0.2
0.3 | -0.36 | -0.3
0.4 | -0.51 | -0.4
0.5 | -0.69 | -0.5
0.6 | -0.91 | -0.6
0.7 | -1.19 | -0.7
0.8 | -1.59 | -0.8
0.9 | -2.26 | -0.9
0.99 | -4.43 | -0.99
0.999 | -6.52 | -0.999
0.9999 | -8.54 | -0.9999
0.99999 | -10.48 | -0.99999
1.0 | -60 | -1.0
2 | -60 | -2
5 | -60 | -5
10 | -60 | -10
15 | -60 | -15
20 | -60 | -20
25 | -60 | -25
30 | -60 | -30
35 | -60 | -35
45 | -60 | -45
50 | -60 | -50
60 | -60 | -60

To modify the MRP to behave like it did before requires three things:

  1. Set the Areas' SpaceOverride settings to Replace. This ensures that within an Area only that Area's settings apply and the world's settings are not added.
  2. Modify the priorities of the Areas so that the second Area which is required to override the first is higher.
  3. Modify the linear damping to around 5; so it's equivalent to what it was before.
    I've attached a modified MRP for convenience:
    AreaReplaceCombine-Updated.zip

Thanks, that makes sense. After making the suggested changes to my project, everything appears to behave correctly. Since this is not a bug I think the issue could be closed?

Yes, thanks for confirming that it works for you. I linked this discussion in the release blog post for other users who might need to do similar adjustments.

Was this page helpful?
0 / 5 - 0 ratings