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

Bounce on edge between two touching cubes #717

Closed
nem0 opened this issue Sep 24, 2023 · 5 comments
Closed

Bounce on edge between two touching cubes #717

nem0 opened this issue Sep 24, 2023 · 5 comments

Comments

@nem0
Copy link

nem0 commented Sep 24, 2023

Steps to reproduce:

  1. create two touching, static cubes with half extents =1
  2. create dynamic sphere with radius == 0.1 on top of one of the cubes
    image
  3. set velocity of the sphere to {5, 0, 0}
  4. run it
  5. observe that the sphere bounces up on the edge between the cubes
    bounce

Expected result:
ball should not bounce on flat surface

@jrouwe
Copy link
Owner

jrouwe commented Sep 24, 2023

What convex radius did you use? With the default convex radius the collision of the boxes will actually look like this:

image

So there will be a gap between the two boxes.

That said, Jolt doesn't currently do 'contact welding' between different objects, meaning that even though you do not see an edge here, there is one and the sphere can collide with it.

Note that this bug is very similar to godot-jolt/godot-jolt#587 so you can look there for some more parameters you can tweak.

In any case, this is an area that I will be working on.

@mihe
Copy link
Contributor

mihe commented Sep 24, 2023

Note that this bug is very similar to godot-jolt/godot-jolt#587 so you can look there for some more parameters you can tweak.

Just to avoid any confusion, since I took some creative liberties when naming some of those settings, the settings highlighted in that issue are (in order) PhysicsSettings::mLinearCastThreshold, PhysicsSettings::mSpeculativeContactDistance and PhysicsSettings::mPenetrationSlop.

@nem0
Copy link
Author

nem0 commented Sep 24, 2023

What convex radius did you use? With the default convex radius the collision of the boxes will actually look like this:

Default radius. Also tried with different values, both smaller and bigger, results were even worse.

Tweaking values from godot-jolt/godot-jolt#587 helped a bit, but it's still not perfect

jrouwe added a commit that referenced this issue Jan 20, 2024
This should help reduce ghost collisions as described in #874 and #717
@jrouwe
Copy link
Owner

jrouwe commented Jan 20, 2024

Hello,

I submitted a potential fix for this issue (set BodyCreationSettings::mEnhancedInternalEdgeRemoval = true). I wrote some documentation for this new functionality here.

Please note that you'll have to make your boxes be part of the same body or else the algorithm will not work. Because of the way Jolt multithreads collision detection, collisions between different body pairs run on different threads, so it is very difficult to make this algorithm work across bodies.

@jrouwe
Copy link
Owner

jrouwe commented Jan 20, 2024

I also posted a video of the results here: https://x.com/jrouwe/status/1748821475623088550?s=20

@jrouwe jrouwe closed this as completed Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants