godotengine / godot

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

Low speed RigidBody overlaps StaticBody then bounces back when collision happens even with CCD enabled and 0 bounce #43605

Open awkr opened 3 years ago

awkr commented 3 years ago

Godot version: v3.2.3.stable.official

OS/device including version: Device: Macbook Pro 2016 OS: macOS Big Sur 11.0.1

Issue description: Yes, I've searched a lot but none of them works.

1️⃣ Given a scenario: In 3D world, there's a StaticBody as ground, a RigidBody with Capsule CollisionShape as player.

2️⃣ Action: Player falls freely to the ground from a low height.

3️⃣ Result: As the title says, player can detect collision and stopped as wanted. But if we look close, the player overlays with the ground (also called tunnelling?), then bounces back, even through the Bounce property of player and ground all set to 0!

4️⃣ Try to solve: I've tried these steps:

  1. Enable CCD. not working :(
  2. Switch physics engine from Bullet to GodotPhysics, and increase physics FPS from 60 to 90. Hmmm seems better, but still some glitches when I stare at the screen...(forgive my perfectionism). Besides I don't think is a better way to solve this kind problem.

5️⃣ Wanted: when bounce is 0 and collision happens, player should stop immediately, no overlaps, no bounce, it should stand still, right here waiting for you :)

Please help me, thank you all.

Minimal reproduction project: The minimal project contains 3 objects: Ground(StaticBody), Player 1(KinematicBody), Player 2(RigidBody). Player 1 works right, Player 2 overlaps and bounces back which is not wanted.

Basic3D.zip

Rubonnek commented 3 years ago

Possible fix: #35945 Related: #35780

awkr commented 3 years ago

Possible fix: #35945 Related: #35780

Great, thank you for information! When will the new version release?

capnm commented 3 years ago

Switch physics engine from Bullet to GodotPhysics

ERROR: CylinderShape is not supported in GodotPhysics. Please switch to Bullet in the Project Settings. at: shape_create (servers/physics/physics_server_sw.cpp:73)

Don't do this.

RigidBody overlaps StaticBody

You might have misunderstood how mesh and collision shape in Godot works. I don't see any issues (v323 linux): grafik

works-fine.zip

awkr commented 3 years ago

@capnm Thanks for your nice try. I've tried your kind artifact, didn't change anything, sorry that I still have the overlap problem. Here is my snapshot(GIF): 2020-11-17 15_45_01

awkr commented 3 years ago

@Rubonnek @capnm Just to mention that, I've compiled the latest Godot(branch master, Godot version v4.0.dev.custom_build.fbe0386c6) and run @capnm project, hmmm, it seems the problem still lies in v4.0. 💔

akien-mga commented 2 years ago

Seems still reproducible in 3.5 RC 1, and it's indeed specific to the GodotPhysics backend, it doesn't happen with Bullet.