Expose JPH::PlaneShape via JPC_PlaneShapeSettings#25
Merged
Conversation
3 tasks
Solidor777
added a commit
to Solidor777/Titan
that referenced
this pull request
May 8, 2026
m34-a-ii shipped Halfspace as a 100×0.05×100 thin static box because
JoltC didn't expose JPH's PlaneShape. The authored normal was ignored;
raycasts returned axis-aligned box-face normals; rotated halfspaces
silently used the ground approximation.
Bumps the Solidor777/JoltC submodule to 3eddf05, which adds a TITAN
PATCH exposing `JPC_PlaneShapeSettings` + `_default` + `_Create`
following the existing BoxShape/SphereShape pattern. Companion one-line
patch on `crates/third_party/joltc-sys/src/lib.rs` adds the new shape
to the `ffi_default!` list so `JPC_PlaneShapeSettings::default()` works
from rust.
`titan-jolt-3d`'s `BodyShape::Halfspace { normal }` arm now constructs
a real `PlaneShape` with the authored normal as the plane's outward
direction and `Constant = 0` (plane through body-local origin). Module
docs updated.
New regression test `halfspace_authors_non_y_normal` raycasts a +X-
normal halfspace and asserts:
- ray distance lands on the plane (5 m for a 5 m offset along the
authored normal)
- raycast surface normal returned by Jolt matches the authored normal
(dot with +X > 0.95). The thin-box approx returned (0, ±1, 0) here.
Existing `dynamic_body_rests_on_static_ground` updated: the ball now
settles at y ≈ radius (0.4..0.6) instead of radius + box-half-extent
(0.4..0.7) since the plane is exactly at y=0.
508 tests pass (was 507). Smoke-launched: editor reaches `boot
complete` cleanly.
Upstream PRs: [SecondHalfGames/JoltC#25](SecondHalfGames/JoltC#25)
+ [SecondHalfGames/jolt-rust#14](SecondHalfGames/jolt-rust#14).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Member
|
Hello and thank you! Can you remove the titan comments from the code? Then it's good to merge! |
JPH ships PlaneShape (an infinite-half-space collider; "negative half
space is solid") but JoltC did not expose it via the C API. Downstream
backends that want a real halfspace primitive — e.g. Titan's
`titan-jolt-3d` mapping its `BodyShape::Halfspace { normal }` — had to
approximate with a thin static box, which loses the authored normal +
forces an arbitrary thickness offset.
Add `JPC_PlaneShapeSettings { UserData, Normal, Constant, HalfExtent }`
+ `_default` + `_Create`. The C-side struct carries Normal + Constant
rather than a Plane wrapper to avoid introducing a new JPC_Plane
binding for a single use site; the implementation constructs the
JPH::Plane via its `Plane(Vec3 normal, float constant)` ctor. Material
is stubbed (`TODO: Material`) consistent with every other
`*ShapeSettings` in the codebase.
PlaneShape MUST be static or kinematic per JPH; that constraint is the
caller's responsibility (matches the existing PlaneShape usage in the
JoltPhysics samples).
Contributor
Author
|
Done — removed both |
Solidor777
added a commit
to Solidor777/Titan
that referenced
this pull request
May 17, 2026
m34-a-ii shipped Halfspace as a 100×0.05×100 thin static box because
JoltC didn't expose JPH's PlaneShape. The authored normal was ignored;
raycasts returned axis-aligned box-face normals; rotated halfspaces
silently used the ground approximation.
Bumps the Solidor777/JoltC submodule to 3eddf05, which adds a TITAN
PATCH exposing `JPC_PlaneShapeSettings` + `_default` + `_Create`
following the existing BoxShape/SphereShape pattern. Companion one-line
patch on `crates/third_party/joltc-sys/src/lib.rs` adds the new shape
to the `ffi_default!` list so `JPC_PlaneShapeSettings::default()` works
from rust.
`titan-jolt-3d`'s `BodyShape::Halfspace { normal }` arm now constructs
a real `PlaneShape` with the authored normal as the plane's outward
direction and `Constant = 0` (plane through body-local origin). Module
docs updated.
New regression test `halfspace_authors_non_y_normal` raycasts a +X-
normal halfspace and asserts:
- ray distance lands on the plane (5 m for a 5 m offset along the
authored normal)
- raycast surface normal returned by Jolt matches the authored normal
(dot with +X > 0.95). The thin-box approx returned (0, ±1, 0) here.
Existing `dynamic_body_rests_on_static_ground` updated: the ball now
settles at y ≈ radius (0.4..0.6) instead of radius + box-half-extent
(0.4..0.7) since the plane is exactly at y=0.
508 tests pass (was 507). Smoke-launched: editor reaches `boot
complete` cleanly.
Upstream PRs: [SecondHalfGames/JoltC#25](SecondHalfGames/JoltC#25)
+ [SecondHalfGames/jolt-rust#14](SecondHalfGames/jolt-rust#14).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Solidor777
added a commit
to Solidor777/Titan
that referenced
this pull request
Jun 4, 2026
m34-a-ii shipped Halfspace as a 100×0.05×100 thin static box because
JoltC didn't expose JPH's PlaneShape. The authored normal was ignored;
raycasts returned axis-aligned box-face normals; rotated halfspaces
silently used the ground approximation.
Bumps the Solidor777/JoltC submodule to 3eddf05, which adds a TITAN
PATCH exposing `JPC_PlaneShapeSettings` + `_default` + `_Create`
following the existing BoxShape/SphereShape pattern. Companion one-line
patch on `crates/third_party/joltc-sys/src/lib.rs` adds the new shape
to the `ffi_default!` list so `JPC_PlaneShapeSettings::default()` works
from rust.
`titan-jolt-3d`'s `BodyShape::Halfspace { normal }` arm now constructs
a real `PlaneShape` with the authored normal as the plane's outward
direction and `Constant = 0` (plane through body-local origin). Module
docs updated.
New regression test `halfspace_authors_non_y_normal` raycasts a +X-
normal halfspace and asserts:
- ray distance lands on the plane (5 m for a 5 m offset along the
authored normal)
- raycast surface normal returned by Jolt matches the authored normal
(dot with +X > 0.95). The thin-box approx returned (0, ±1, 0) here.
Existing `dynamic_body_rests_on_static_ground` updated: the ball now
settles at y ≈ radius (0.4..0.6) instead of radius + box-half-extent
(0.4..0.7) since the plane is exactly at y=0.
508 tests pass (was 507). Smoke-launched: editor reaches `boot
complete` cleanly.
Upstream PRs: [SecondHalfGames/JoltC#25](SecondHalfGames/JoltC#25)
+ [SecondHalfGames/jolt-rust#14](SecondHalfGames/jolt-rust#14).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
JoltC does not expose
JPH::PlaneShape(the infinite-half-space collider; "negative half space is solid"). Downstream consumers that want a real halfspace primitive — for example mapping aHalfspace { normal }shape from a higher-level physics abstraction — have no choice but to approximate with a thin static box, which loses the authored normal direction and forces an arbitrary thickness offset.Fix
Add
JPC_PlaneShapeSettings+ matching_default/_Createexports following the same pattern asJPC_BoxShapeSettings,JPC_SphereShapeSettings, etc.The C-side struct carries
Normal+Constantrather than aJPC_Planewrapper to avoid introducing a new binding type for a single use site; the C++ side constructs theJPH::Planevia itsPlane(Vec3 normal, float constant)ctor.Materialis stubbed with aTODOcomment, consistent with every other*ShapeSettingsin the codebase.HalfExtentdefaults toJPH::PlaneShapeSettings::cDefaultHalfExtent(1000.0f), matching JPH's own default.Constraint
PlaneShapeMUST be static or kinematic per JPH (PlaneShape::MustBeStatic() == true). Caller's responsibility, same contract asJoltPhysics/Samples/Tests/Shapes/PlaneShapeTest.cppupstream.Validation
Downstream verification: Titan engine's
titan-jolt-3dplugin uses this binding to back itsBodyShape::Halfspace { normal }. New integration test (halfspace_authors_non_y_normal) raycasts a non-+Y halfspace and asserts:The same test against the prior thin-box approximation returned axis-aligned normals on the box faces, never the authored plane normal — concrete evidence that the new path actually exercises
PlaneShape::GetSurfaceNormal.Test plan
mainon Windows host (msvc).JPC_PlaneShapeSettings_Createreturns a validJPC_Shape*for a +Y normal at the origin.TODOlike every other shape).