Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3D Physics: Continuous Collision Detection fails regularly #69676

Closed
michael-nischt opened this issue Dec 6, 2022 · 6 comments
Closed

3D Physics: Continuous Collision Detection fails regularly #69676

michael-nischt opened this issue Dec 6, 2022 · 6 comments

Comments

@michael-nischt
Copy link

Godot version

v4.0.beta7.official [0bb1e89]

System information

Arch Linux, GeForce 3080

Issue description

3D Physics: Continuous Collision Detection fails regularly when enabled on a rigid body.

TunnelBug.mp4

Steps to reproduce

Launch and play the attached project.

Hold SPACE to apply a force to the ball until it tunnels through a mesh collider and two adjacent box colliders.

The ball.gd script has a

const TUNNEL : bool = true

with that set to false the static bodies are positions slightly different the ball collides as expected.

Minimal reproduction project

TunnelBug3D.zip

@rick551a
Copy link

rick551a commented Dec 6, 2022

To solve:
Make the collision shape convex on your ball.

How:

  1. Delete the collision shape you have now for the ball

  2. Click the mesh in the node tree, click the 'mesh' button and on the dropdown click 'Create simplified convex collision sibling'
    , or append -convcol to object name in blender to get a convex shape on import

Observe, it works!

Note:
Had this 'issue' in 3.x too, maybe a note in the help files is required, about convex collisions etc.

@michael-nischt
Copy link
Author

To solve: Make the collision shape convex on your ball.

How:

1. Delete the collision shape you have now for the ball

2. Click the mesh in the node tree, click the 'mesh' button and on the dropdown click 'Create simplified convex collision sibling'
   , or append -convcol to object name in blender to get a convex shape on import

Observe, it works!

Note: Had this 'issue' in 3.x too, maybe a note in the help files is required, about convex collisions etc.

Thanks for sharing a possible the workaround! 🙏

I'm not sure though it will have other issues in our main project. Like having the ball not roll smoothly on the ground. Maybe having two collisions shapes, the simplified convex shape and the sphere (slightly bigger) will work. I will try tomorrow.

Anyway, it is only a workaround. I mean there's no good reason why the sphere, a simpler shape and pure geometric convex shape, should not be equally or even more precise (and performant), right?

@Calinou
Copy link
Member

Calinou commented Dec 6, 2022

Duplicate of #9071.

@Calinou Calinou closed this as not planned Won't fix, can't repro, duplicate, stale Dec 6, 2022
@michael-nischt
Copy link
Author

Sadly the workaround doesn't work in the actually project. It believe decreased the likelihood a bit but still going through walls despite lower forces/speeds than the mini project. 😞

@Calinou
Copy link
Member

Calinou commented Dec 7, 2022

Making colliders thicker than the visual representation and increasing physics ticks per second in the project settings (Physics FPS in 3.x) is usually the best way to combat tunneling. To avoid excessive CPU usage, don't pick a value that's too high (and prefer values that are multiples of 60 when not using physics interpolation, such as 120, 180 or 240).

@michael-nischt
Copy link
Author

Well, I tried 240 and it didn't happen often but still every now and then. Sadly any tunneling would be game breaking for us.

My new approach is to write my own physics simulation on top of Godot's move_and collide (which always prevents tunneling) by moving one object at a time.
So far already works flawlessly with static colliders / objects and handles bouncing. too.
Hope I can add support for interacting with rigid body like objects with energy transfer and all later this week. 🤞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants