1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Improve RigidDynamicBody contacts in 2D and 3D

Changed the algorithm for solving contacts to keep previous contacts as
long as they are under the max separation threshold to keep contact
impulses more consistent and contacts more stable.

Also made 2D consistent with 3D and changed some default parameters:
-Contact bias is now 0.8 instead of 0.3 to avoid springy contacts
-Solver iterations are 16 instead of 8 by default for better stability

Performance considerations:
Tested with stress tests that include lots of contacts from overlapping
bodies.
3D: There's no measurable difference in performance.
2D: Performance is a bit lower (close to 10% slower in extreme cases)
The benefit for 2D physics to be much more stable outweighs the slight
decrease in performance, and this could be alleviated by changing the
algorithm to use jacobians for contact solving to help with cache
efficiency and memory allocations.
This commit is contained in:
PouleyKetchoupp
2021-12-03 10:38:40 -07:00
parent 80e292b3e0
commit 5cbc7149a1
7 changed files with 157 additions and 116 deletions

View File

@@ -1226,7 +1226,7 @@ void GodotPhysicsServer2D::set_collision_iterations(int p_iterations) {
void GodotPhysicsServer2D::init() {
doing_sync = false;
iterations = 8; // 8?
iterations = 16;
stepper = memnew(GodotStep2D);
};