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] Raycasts sometimes go through convex shapes and hit the far side when BT_USE_DOUBLE_PRECISION is enabled. #40586

Open
Tracked by #45022
jitspoe opened this issue Jul 22, 2020 · 1 comment

Comments

@jitspoe
Copy link
Contributor

jitspoe commented Jul 22, 2020

Godot version: 3.2.2.rc.custom_build.d69b856a4

OS/device including version: Windows 8.1

Issue description:
Had precision issues with bullet collision detection, so I compiled with BT_USE_DOUBLE_PRECISION defined. That improved the kinematic collision issues, but made raycasts sometimes go through the front surface of convex collision. I also created an issue on the bullet github in case it's an issue with the library: bulletphysics/bullet3#2949

image
Here the raycast is coming from the right and goes through the convex collision. Green line points to collision location. Cyan line is the normal.

With double precision disabled:
image

Steps to reproduce:
Define BT_USE_DOUBLE_PRECISION in scons, compile, and try raycasting against a convex shape (can be as simple as a box, but not an actual "box shape" shape) from different angles. Some will go through.
env_base.Append(CPPDEFINES=["BT_USE_DOUBLE_PRECISION"]) in SConstruct file.

Minimal reproduction project:

Test Double Precision Raycast.zip

Here's a build of the engine with double precision enabled:
godot.windows.opt.tools.32_double_precision_bullet.zip

@jitspoe
Copy link
Contributor Author

jitspoe commented Jul 22, 2020

It SEEMS like adding btResult.m_flags |= btTriangleRaycastCallback::kF_UseGjkConvexCastRaytest; to BulletPhysicsDirectSpaceState::intersect_ray() may fix the issue. Haven't tested how that behaves with double precision off, though. I think we want to have double precision enabled unless there's some sort of performance issues with it. It has significantly improved the kinematic collision accuracy.

@pouleyKetchoupp pouleyKetchoupp changed the title Raycasts sometimes go through convex shapes and hit the far side when BT_USE_DOUBLE_PRECISION is enabled. [Bullet] Raycasts sometimes go through convex shapes and hit the far side when BT_USE_DOUBLE_PRECISION is enabled. Jan 15, 2021
@fabriceci fabriceci modified the milestones: 4.0, 3.x Mar 26, 2022
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