Skip to content

Fix ConcavePolygonShape3D always enabling backface_collision when using Jolt Physics #104310

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

Merged
merged 1 commit into from
Mar 18, 2025

Conversation

mihe
Copy link
Contributor

@mihe mihe commented Mar 18, 2025

Fixes #104309.

This fixes the issue of ConcavePolygonShape3D always behaving as if its backface_collision was enabled when using Jolt Physics as the 3D physics engine.

Prior to godot-jolt/godot-jolt#967 the JoltCustomDoubleSidedShape decorator shape was conditionally wrapped around the ConcavePolygonShape3D's underlying JPH::MeshShape, which meant we could always override JPH::CollideShapeSettings::mBackFaceMode and JPH::ShapeCastSettings::mBackFaceModeTriangles with JPH::EBackFaceMode::CollideWithBackFaces.

However, godot-jolt/godot-jolt#967 changed this so that we always wrapped the underlying JPH::MeshShape, and instead provided a boolean member variable (JoltCustomDoubleSidedShape::back_face_collision) to indicate whether back-face collisions were enabled or not, and I forgot to add a condition to the above mentioned overrides of mBackFaceMode and mBackFaceModeTriangles in the process.

So this PR fixes this by simply adding said conditions.

@mihe mihe added bug topic:physics topic:3d cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release labels Mar 18, 2025
@mihe mihe added this to the 4.5 milestone Mar 18, 2025
@mihe mihe requested a review from a team as a code owner March 18, 2025 11:25
@mihe mihe force-pushed the jolt/back-face-collision branch from 1783ad7 to 3603a5a Compare March 18, 2025 11:26
@mihe mihe changed the title Fix ConcavePolygonShape3D always using backface_collision with Jolt Fix ConcavePolygonShape3D always enabling backface_collision when using Jolt Physics Mar 18, 2025
@akien-mga akien-mga merged commit fc827bb into godotengine:master Mar 18, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks!

@akien-mga
Copy link
Member

Cherry-picked for 4.4.1.

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

Successfully merging this pull request may close these issues.

ConcavePolygonShape3D effectively always enables backface_collision when using Jolt Physics
2 participants