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] Godot 3.x with Bullet, collision layer & mask choice affects collision accuracy #53219

Open
Tracked by #45022
m4nu3lf opened this issue Sep 29, 2021 · 1 comment

Comments

@m4nu3lf
Copy link
Contributor

m4nu3lf commented Sep 29, 2021

Godot version

3.x build 65ab913

System information

OS: Arch Linux, CPU: Ryzen 5, GUP: RX 480

Issue description

Collisions between two physics bodies behave better when the collision layer & mask are chosen so that
(collision_layer_a & collision_mask_b) != 0 AND (collision_layer_b & collision_mask_a) !=0 with respect to when
(collision_layer_a & collision_mask_b) != 0 AND (collision_layer_b & collision_mask_a) ==0
or
(collision_layer_a & collision_mask_b) == 0 AND (collision_layer_b & collision_mask_a) !=0
but two bodies should either not collide or properly collide.

This could also be affecting CCD.

Steps to reproduce

Attached is a project with two scenarios in which the only difference is the collision layer of the two rigid bodies.
The two rigid bodies have the same properties except for position & initial velocity (so same layer & collision mask).
In the well-behaved one, the rigid bodies are both stopped by the static one.
In the not well behaved one, the slow rigid body is stopped, but the fast one is not.

Minimal reproduction project

godot_bullet_collision_bug.zip

@pouleyKetchoupp pouleyKetchoupp changed the title Godot 3.x with Bullet, collision layer & mask choice affects collision accuracy [Bullet] Godot 3.x with Bullet, collision layer & mask choice affects collision accuracy Sep 29, 2021
@pouleyKetchoupp
Copy link
Contributor

pouleyKetchoupp commented Sep 29, 2021

Looks like a bug in Bullet with CCD not using custom collision filtering, but I'm not sure what the proper fix is.

This line is using default collision filter logic in Bullet CCD:

if (!ClosestConvexResultCallback::needsCollision(proxy0))
return false;

Which forces (collision_layer_a & collision_mask_b) != 0 AND (collision_layer_b & collision_mask_a) !=0 in order to work correctly.

I've just opened a discussion upstream:
bulletphysics/bullet3#3983

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

4 participants