godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.57k stars 20.55k forks source link

[GodotPhysics] Thin collision shapes cause resting RigidBodies to shake at low physics FPS #62819

Open kubecz3k opened 2 years ago

kubecz3k commented 2 years ago

Godot version

c41e4b10c3317f837d4b3ece2fb725a8067d884b (4.x)

System information

Ubuntu 22.04

Issue description

By lowering physic tick rate to 30 I was able to observe that some bodies in the project I'm working on are trapped in kind of endless feedback loop and they are unable to rest: rigid_shake

Probably worth to mention, I did similar test on Godot 3 and I was unable to reproduce similar behavior on mass = 1000 (weight 9800) with physic tick rate at 10 (on gif tick rate=20, mass = 100kg)

Steps to reproduce

  1. Lower project physics tick rate to 20
  2. Create new scene with Static body as a floor
  3. Create 3D RigidBody with a cube as a collider with default size, increase its mass to 100
  4. Put the cube above the ground
  5. Give it some angular velocity, experiment with various values
  6. You should be able to observe that the cube sometimes refuses to rest

Minimal reproduction project

rigid_shake.zip

kubecz3k commented 2 years ago

cc @pouleyKetchoupp

Calinou commented 2 years ago

I can confirm this on 4.0.alpha 1b057e18f.

This is caused by the floor's collision shape being too thin (0.1 units). Making it 1 unit instead solves the issue on my end. The issue is therefore similar to https://github.com/godotengine/godot/issues/9071, except it's happening with individual contacts rather than the entire body.

Probably worth to mention, I did similar test on Godot 3 and I was unable to reproduce similar behavior on mass = 1000 (weight 9800) with physic tick rate at 10 (on gif tick rate=20, mass = 100kg)

Can you test this with the 3D physics engine set to GodotPhysics in 3.x? Also, please upload the minimal reproduction project for Godot 3.x.

cc @pouleyKetchoupp

He's no longer involved in Godot, so please don't ping him in the future.

kubecz3k commented 2 years ago

Even taking into account new information from @Calinou I'm unable to reproduce in 3.4.4. Attaching 3.4.4 project if anyone feels like experimenting ShakyCollisionTest.zip (again not a reproduction since can't reproduce)

rburing commented 2 years ago

I can reproduce it in 3.5-rc6 and also 3.4.4, both with Godot Physics. It doesn't happen frequently though. Opening multiple Godot processes seems to reproduce it more quickly, but I was also able to reproduce it in a single process. The above ShakyCollisionTest.zip has the physics engine set to Bullet. I also wasn't able to reproduce it with Bullet.