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

[Bullet] Rigid and Kinematic bodies use different collision detection algorithms. #47496

Open
Tracked by #45022
e344fde6bf opened this issue Mar 30, 2021 · 1 comment

Comments

@e344fde6bf
Copy link
Contributor

Godot version:
3.2.3

OS/device including version:
N/A

Issue description:

From the bullet manual, the default algorithms used for collision detection are taken from this matrix:

box sphere convex, cylinder, cone, capsule compound triangle_mesh
box boxbox spherebox gjk compound concaveconvex
sphere spherebox spheresphere gjk compound concaveconvex
convex, cylinder, cone, capsule gjk gjk gjk or SAT compound concaveconvex
compound compound compound compound compound compound
traingle_mesh concaveconvex concaveconvex concaveconvex compound gimpact

In Godot's bullet backend rigid bodies seem to use the default algorithms, however kinematic bodies seem to use gjk for all convex shapes including box and sphere.

This can make a major a difference for boxbox collisions when using large collision margins. Bullet uses the margin value to round out sharp edges with spheres that have a radius equal to the margin value. However, bullet's boxbox algorithm is a special case that does not use the margin value, while gjk does.

Here's a demonstration showing the difference for the boxbox case. I used OpenSCAD's minkowski() to generate visual representations of the exact collision shapes used by bullet in the gjk case. The red boxes are rigid bodies, the gray ones kinematic:

bullet-boxbox-collisions.mp4

There doesn't seem to be much difference for the spheresphere and spherebox cases, however minor differences in how rigid and kinematic bodies calculate the separation between shapes can contribute to #31981 (though this is not the main cause of that bug).

Steps to reproduce:

  • Create kinematic and rigid boxes with large margin values and collide them together.

Minimal reproduction project:
bullet-boxbox-collisions.zip

@Calinou
Copy link
Member

Calinou commented Mar 30, 2021

cc @pouleyKetchoupp

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

2 participants